I have a local repo on my laptop which already has a remote called origin
. Apart from my laptop and origin
, there is a third machine called remote1
which I want to add as another remote to my local repo. What I do on my laptop is
git remote add remote1
git remote set-url remote1 ssh://sshUser@remote1Address:path/to/.git
But when doing so, the command
git push remote1 branchName
gives
ssh: connect to host remote1Address port 22: Connection timed out.
Accessing remote1 through ssh
is possible only through
a jump proxy. Port 22
being closed is the main reason behind using a jump proxy in this
case; Here is my
.ssh/config
Host jumpProxy
Hostname jumpProxyAddress
User jumpUser
Host remote1
Hostname remote1Address
User sshUser
ProxyJump jumpUser@jumpProxyAddress
so I guess
the source of the problem is that the jump proxy is not called at all, that
is, .ssh/config
is not read at all. What solution do you suggest?
I see two things wrong with your git remote set-url
statement:
remote1
in ~/.ssh/config
with the proxy and user details, but you aren't using it.ssh://
then there should be a slash between the user@host
details and the repository path (not a colon).You should be able to fix both with a single statement: git remote set-url remote1 ssh://remote1/path/to/.git
. (Note that there's no user@
there; it's defined in your ~/.ssh/config
.)