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