简体   繁体   中英

Git clone works with https but not SSH when using Proxy

In my area, download speed is too slow when git clone. So I use Shadowsocks as my proxy on Macbook Mojave, but shadowsocks can't supply proxy for terminal directly, therefore I use Proxifier as transition. The terminal is iTerm2. They are all the background.

When using proxy, the git clone with ssh can't work and the error is

git clone git@github.com:zergtant/pytorch-handbook.git  
Cloning into 'pytorch-handbook'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

But git clone work well with https when using proxy.

Could anyone give me some hint about this problem?

Thank you very much for helping.

You would need to:

That is:

git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

(replace 1080 by your proxyfier port in your case)


The OP georw reports in the comments it does work with Shadowsocks alone, but not in combination with Proxifier.

Proxifier is configured well to proxy socks.

When the error occurs, logs of Proxifier is

ssh-github. Com:22 open through proxy127.0.0.1:10801 SOCKS5 ssh-github. Com:22 close21 bytes sent0 bytes received lifetime <1 sec.

So I found the reason is caused by ssh command.
When I input ssh -vvv git@github.com in the terminal, the output error is

ssh_exchange_identification: Connection closed by remote host.

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