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








