简体   繁体   中英

git remote repository and login server

I have a git repository on a server to which I only can connect via a login server. I usualy make a ssh connect to the gitserver with this command:

ssh loginserver -t ssh gitserver

Can I use this in git too, in order to get a working remote repo?

thanks

You can configure SSH to do this whenever you want to connect to gitserver , so also when Git calls SSH. Put the following stanze in .ssh/config :

Host gitserver
    Hostname gitserver.full.domain.name
    ProxyCommand ssh -q loginserver nc %h %p

ssh gitserver will now connect to loginserver and execute nc (netcat) there to get to gitserver . Obviously, netcat has to be installed on loginserver for this to work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM