Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 SSH.

How can I push commits to server2 with double SSH? Is it possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
984 views
Welcome To Ask or Share your Answers For Others

1 Answer

Have a look at ssh's ProxyCommand. By adding a section into your ssh config file like

Host server2 ProxyCommand ssh -q server1 nc -q0 %h 22

you should be able to use git with a repo an server2. Note: This requires nc being available on server1.

This solution makes accessing server2 through ssh, e.g. with git, transparent as if it was directly accessible.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...