[Git] 使用unshallow來解除grafted狀態,來解決使用depth的問題

要 git push 時所遇到error: failed to push some refs

阿強
2 min readMay 5, 2020

使用減少git clone 下載的時間與空間,當要git push目前local的repository到remote repository時,會出現error: failed to push some refs,原因是在git clone時下了depth=1並沒有完整的log,如下圖。

depth=1

為此必須要將完整的refs資料pull到local,先確認remote 有哪些,與當前的branch在哪。

#查看remote
$ git remote -v
#需確認要pull的remote
$ git pull origin --unshallow

unshallow結束後,git log時可看到完整的記錄

完整的log

--

--

阿強
阿強

Written by 阿強

一個喜歡研究新事物的軟體工程師

No responses yet