環境:ubuntu16.04
方法:通過socks5代理並且使用http鏈接
步驟:
1.設置全局使用socks5代理,並且使用http傳輸
git config --global http.proxy socks5://localhost:1080 (1080是設置的本地socks5
端口
,根據自己代理客戶端設置的端口而定)
2.列出剛配置的設置情況
git config --global --list
3.如果要clone的git倉庫鏈接為https://github.com/haha.git,要將https改為http,即為http://github.com/haha.git
4.可以直接clone了
注意事項:
1.當git pull時使用代理會出現以下錯誤提示:
jello@jello:~/linux$ git pull
fatal: unable to access 'http://github.com/torvalds/linux.git/': Failed to connect to localhost port 1080: Connection refused
2.解決方法:
2.1取消代理設置
git config --global --unset http.proxy