Git代理,用于解决clone GitHub代码慢的问题


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/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM