v*2*ra--y的http/https協議不支持GitHub的代理,會報Proxy CONNECT aborted這個錯,但是socks5是可以的,所以讓Git的代理走socks5協議(需要在Github上添加自己的公鑰),在C:\Users\Administrator\.gitconfig內配置如下(僅代理Github,其他的git操作不走代理):
[http "https://github.com"] proxy = socks5://127.0.0.1:1082
或者單次代理:
-c http.proxy="socks5://127.0.0.1:1082"
s*s時候clone時可以走http協議,增加下面參數即可:
-c http.proxy="127.0.0.1:1081"
參考(下面命令設置與在.gitconfig文件中設置效果一樣):
// 全局設置 git config --global https.proxy http://127.0.0.1:1082 git config --global https.proxy https://127.0.0.1:1082 git config --global http.proxy 'socks5://127.0.0.1:1082' git config --global https.proxy 'socks5://127.0.0.1:1082' // 針對某個domain設置 git config --global http.https://github.com.proxy socks5://127.0.0.1:1082 git config --global https.https://github.com.proxy socks5://127.0.0.1:1082 git config --global http.https://github.com.proxy https://127.0.0.1:1082 git config --global https.https://github.com.proxy https://127.0.0.1:1082
參考:https://struggleblog.com/2018/07/13/accelerate_github_clone/