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.
Lovely. That worked. Sadly that means that everyone who wants to work on the project has to update their personal config file, but it at least gets me through this.
Now I have permission or project name issues, but at least I got to the server. Thanks.
The guy that ported the project decided to change the group name to PascalCase. I’m going to yell at him. Even if that isn’t the problem.
I just tested with Elixir 1.14.5 on OTP 26 and specifying the git URL as ssh://git@example.com:4321/repo does work to specify the port.
What mix deps.get does with dependencies like this is create a git repository, add a remote origin with the specified URL, then call git fetch to fetch from the remote. If you can clone from ssh://git@gitlab2.mycompany.net:4321/myprojgroup/my_dep1.git, it should also work as a dependency.
Once I read your instructions a few times and tried variations I figured out that what you meant was writing my dependency as: {my_dep1, git: “ssh://git@gitlab2.mycompany.net:4321/myprojgroup/my_dep1.git”, env: Mix.env()},
At first I didn’t realize you meant that I should keep the git: part, and nothing went well.
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.