Accessing a git repository via ssh behind a firewall

前端 未结 3 1699
北荒
北荒 2021-01-30 15:25

I would like to access (clone/push/pull) a private (via ssh) git repository while behind a corporate firewall that only allows http proxy access. I have written a robust Java (d

相关标签:
3条回答
  • 2021-01-30 15:39

    Can you get a normal ssh (command-line) session going? If so, git should also work.

    When using ssh, git should pick up your configuration options in .ssh/config. If that is not enough, you can point the environment variable GIT_SSH at a modified version of ssh (or shell script wrapper).

    0 讨论(0)
  • 2021-01-30 15:49

    Using socat and a .ssh/config like this:

    Host=foo.server.com
    ProxyCommand=socat - PROXY:your.proxy.ip:%h:%p,proxyport=3128,proxyauth=user:pwd
    

    You should be able to ssh to foo.server.com and

    git clone ssh://foo.server.com/var/git/myrepo.git
    

    is expected to work.

    0 讨论(0)
  • 2021-01-30 15:50

    This is my setup working under a Linux machine (localhost on port 18081 is a proxy).

    cat ~/.ssh/config
    Host  github.com
      User git
      ProxyCommand nc -x localhost:18081 -Xconnect %h %p
    
    0 讨论(0)
提交回复
热议问题