I have: local, server1, server2.
I have Git repository on server2. But I can\'t connect with it. I can connect to server1 with SSH and then connect to server2 with S
One solution is to prepare SSH tunnel on gateway host (server1), and use Git with the local end (you might need to use .ssh/options
to configure port).
Another is a pure Git solution to use ext:: remote helper with double SSH (you better set up password-less public key based authentication at least on gateway, or you would have to give passwords twice). For example:
local ~$ git clone \
"ext::ssh -t user@server1 ssh server2 %S 'repo'" repo
Cloning into 'repo'...
Checking connectivity... done.
Here %S
will be expanded by Git into full name of appropriate service, git-upload-pack
for fetching and git-receive-pack
for push. The -t
option is needed if logging to internal host uses interactive authentication (e.g. password).
Note that you need to give the name or directory to download to as the last parameter to git clone
command (repo
here) to the resulting repository here; otherwise Git would use the command (ssh ...
) as name.
Then you would be able to fetch and push to repository by the name "origin".