git clone時加上--depth 1


當項目過大時,git clone時會出現error: RPC failed; HTTP 504 curl 22 The requested URL returned error: 504 Gateway Time-out的問題



解決方法很簡單,在git clone時加上--depth=1即可解決



克隆的項目只包含最近的一次commit的一個分支,體積很小,即可解決文章開頭提到的項目過大導致Timeout的問題,但會產生另外一個問題,他只會把默認分支clone下來,其他遠程分支並不在本地,所以這種情況下,需要用如下方法拉取其他分支:

$ git clone --depth 1 https://github.com/dogescript/xxxxxxx.git
$ git remote set-branches origin 'remote_branch_name'
$ git fetch --depth 1 origin remote_branch_name
$ git checkout remote_branch_name

 


免責聲明!

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



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