Sinc
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.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
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
insteadOfgit config with some tricks, as exampled in the docs:mix deps — Mix v1.20.2 "
hauleth
Have you tried setting port for that host in
.ssh/config?Sinc
None of them work out of the box, but I failed to report versions. We’re still running Elixir 1.14.25 on OTP26.2.5. Do you think that would affect it?
Sinc
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.
Sinc
I tried doing the config with the url.”myURL:4321”.insteadOf myURL but it gave me the same error about port 22.
Looks like for now I’ll have to go with the underlying SSH config, unless I can talk the migration team out of the alternate port.
joram
I just tested with Elixir 1.14.5 on OTP 26 and specifying the git URL as
ssh://git@example.com:4321/repodoes work to specify the port.What
mix deps.getdoes with dependencies like this is create a git repository, add a remoteoriginwith the specified URL, then callgit fetchto fetch from the remote. If you can clone fromssh://git@gitlab2.mycompany.net:4321/myprojgroup/my_dep1.git, it should also work as a dependency.Sinc
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.Sinc
My bad. I missed that you inserted the ssh:// at the beginning of what I had. So this was the solution.
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.