寫在前面,年後第一篇
問題出現是,Windows系統更新後,重新 git clone github庫,報錯,但是gitee,gitlab或者公司的gitlab代碼庫都是可以正常通路的…
首先知道 git clone 的,是基于 用戶端(我這裡是Windows git ,直接官網下載下傳Exe,正常安裝即可),的指令行,我們要clone的基于Github,Gitee,Gitlab等(目前我隻知道這幾種)服務端的代碼庫下載下傳,服務端也一緻提供了兩種連結資源位址方式,如下
- Clone with HTTPS
https://github.com/tonels/RBAC.git
- Clone with SSH
[email protected]:tonels/RBAC.git
這是僅有的兩個 服務端提供給用戶端Git的資源連結位址,除此之外,頁面其實還有打包後的代碼庫
這兩種方式,是基于兩個不同的通路協定
- Https(端口443),Use Git or checkout with SVN using the web URL.
- SSh(端口22),Use a password protected SSH key
關于這個錯誤,其實已經很明确是我們 通過Https協定的連結位址問題,當然位址肯定不會有問題,問題是Github版本有更新,對Git clone https://xxx 的操作,多了憑證認證
一、解決方案
1.1、代理伺服器配置
git config --global http.proxy http://proxyuser:[email protected]:8080
- change proxyuser to your proxy user
- change proxypwd to your proxy password
- change proxy.server.com to the URL of your proxy server
- change 8080 to the proxy port configured on your proxy server
重置目前代理伺服器
git config --global --unset http.proxy
檢視目前代理伺服器
git config --global --get http.proxy
關于代理伺服器,肯定是另一個伺服器,或許本地也能配置成本地的代理?有精力的可以試試,嗯,畢竟隻是Github才特有的問題
1.2、更換另一個連結位址
另一個就是 SSH協定位址了,具體配置使用如下,
此處連結
1.3、更換代碼伺服器
這個意思就是把目前代碼從Github上遷到gitlab,或者碼雲上,這樣,正常操作 git clone 就不會有問題了
1.4、使用憑證助手 + Access Token + Basic Authentication
git config --global credential.helper wincred