解決拉取github倉庫報錯“gnutls_handshake() failed”問題


本文首發於:https://blog.frytea.com/archives/421/

gnutls_handshake() failed: The TLS connection was non-properly terminated.

最近為新配置的虛機拉取庫,但是從 GitHub 拉取庫總是出問題,查閱網上文獻將問題鎖定在代理,但是找了一圈還是沒有找到答案。

經過仔細排查,發現還是由於代理設置有錯,為 http 錯誤配置了 https 的代理,導致出錯。

如果沒有配置代理,可使用以下命令 取消代理

git config --global --unset http.proxy
git config --global --unset https.proxy

如果需要使用 代理http 協議通過以下命令配置,使用 7890 端口為例:

git config --global http.https://github.com.proxy http://127.0.0.1:7890
git config --global https.https://github.com.proxy https://127.0.0.1:7890

socket 協議通過以下命令配置,使用 7890 端口為例:

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

也可以這樣子 僅代理 GitHub

git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
#取消代理
git config --global --unset http.https://github.com.proxy

拓展閱讀


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM