因為各種原因(例如 Git Server 是公司自架的,因此憑證被判定為不受信任的來源)沒辦法正常 clone 專案。
這裡記錄幾種可嘗試方案
使用 token
現在大多數 git server 都有提供Personal Access Token功能。
例如 Github 在 Settings > Developer Settings > 🗝️Personal access tokens
然後用 token clone,例如今天 token 是 1965cfb84877 則 clone 語法就如下
git clone https://1965cfb84877@github.com/john/smith.git
使用 Config 忽略 SSL 憑證
可以有兩種做法
設置 git 變數
git config --global http.sslVerify false在 clone 時加上參數
git clone git@github.com:john/smith.git --config http.sslVerify=falsegit clone https://john@github.com/john/smith.git --config http.sslVerify=false
這種做法在安全性上風險較高,僅在確定沒問題時才能使用。
沒有留言:
張貼留言