Sinc

Sinc

Can mix dependencies specify an SSH port?

My company is porting our Gitlab instance to a new server, and in keeping with company habits has set port 4321 for SSH.

This is creating a problem for me for mix dependencies.

I change the origin URL to the new location with:
git remote set-url origin ssh://git@gitlab2.mycompany.net:4321/myprojgroup/myproj.git and that seems to be working fine.

But now I want to get one of the dependencies from the same repo so I updated the dependency line to:
{:my_dep1, git: “git@gitlab2.mycompany.net:4321/myprojgroup/my_dep1.git”, env: Mix.env()},
I also tried without the port, and with the port followed by a colon instead of the slash. In each case I get the same errors:

mix deps.get

* Updating my_dep (git@gitlab2.mycompany.net:myprojgroup/my_dep.git)
  ssh: connect to host gitlab2.mycompany.net port 22: No route to host
  fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
\*\* (Mix) Command “git --git-dir=.git fetch --force --quiet --progress” failed

The part in parentheses after my_dep copies what is in the mix.exs, but the error always says that it couldn’t connect to host port 22.

Do I need to make them go back to port 22, or is there a way to specify the port in the dependency?

P.S. I tried to put the error response in triple back ticks, but on three separate attempts the web page locked up and wouldn’t respond anymore. I’m not sure whether that was after 2 ticks or 3, but the third one didn’t show up in any case.

Marked As Solved

NobbZ

NobbZ

I can’t test it, though I expect the git: "ssh://git@gitlab2.mycompany.net:4321/myprojgroup/myproj.git" to work out of the box.

URLs without an explicit schema work differently.

Alternatively you should be able to use insteadOf git config with some tricks, as exampled in the docs:

mix deps — Mix v1.18.4 "

Also Liked

Sinc

Sinc

After working through @joram ‘s post I looked back at your and realized that you had the same “ssh://” in yours that I misunderstood in his. Which means you were right in the first place, and I have to read more carefully.

Thanks all.

Where Next?

Popular in Questions Top

SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement