使用SOCKS5代理时无法克隆回购

时间:2019-04-23 07:46:15

标签: git ssh socks

我正坐在防火墙后面,需要配置我的git-config,以便使用我的socks5代理。我已经尝试了几种方法,但最终还是得到:

$ git clone git@my-gitlab.de:username/testprojekt.git
Cloning into 'testprojekt'...
ssh: connect to host my-gitlab port 22: Connection timed out
fatal: Could not read from remote repository.

当我使用putty时,我遇到了同样的问题,但是我能够将代理设置存储在那里,并且此后的连接正常。 我可以通过https克隆存储库,但我真的想让我们成为SSH

我尝试过的方法无效:

git config --global http.proxy socks5://myProxy:1080
git config --global http.proxy socks://myProxy:1080

使用后

$ git config --get http.proxy

我得到正确的输出:

socks5://myProxy:1080

,但是仍然可以看到相同的错误。我正在使用适用于Windows的Git

编辑:

$ ssh -T git@myGitlab.de

已经超时

这是我尝试解决该问题的资源之一: https://gist.github.com/evantoli/f8c23a37eb3558ab8765

1 个答案:

答案 0 :(得分:0)

您已经配置了http.proxy,但正在尝试使用ssh://协议通过它进行连接。那当然毫无意义。

您需要配置ssh才能使用袜子代理。例如,请参见https://superuser.com/questions/454210/how-can-i-use-ssh-with-a-socks-5-proxy

ProxyCommand /usr/bin/nc -X 5 -x myProxy:1080 %h %p
相关问题