Git操作中HTTP錯誤

如果你在使用 HTTP 協議進行 Git 操作的時候出現錯誤提示:


401 錯誤:

$ git push origin master
error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

Everything up-to-date


403 錯誤:

$ git push origin master
error: RPC failed; result=22, HTTP code = 401
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date
上面2個錯誤有以下幾個可能導致的:

Git 版本過低。GitCafe 推薦使用的 Git 版本是 >= 1.7,請參考這裏獲取最新版本。

$ git --version git version 1.8.2.1
遠程倉庫路徑設置錯誤。注意,GitCafe 對於路徑的識別是大小寫敏感的。

查看已有的遠程倉庫:

$ git remote -v
origin https://gitcafe.com/GitCafe/help.git (fetch)
origin https://gitcafe.com/GitCafe/help.git (push)
設置新的遠程倉庫路徑:

$ git remote set-url origin https://gitcafe.com/GitCafe/Help.git
查看新的遠程倉庫路徑:

$ git remote -v
origin https://gitcafe.com/GitCafe/Help.git (fetch)
origin https://gitcafe.com/GitCafe/Help.git (push)
對該倉庫沒有訪問權限。檢查你是否對目標倉庫有相應的讀寫權限。

輸入了錯誤的用戶名和密碼。檢查你是否使用了對該倉庫有寫權限的正確的賬戶名稱和密碼,檢查是否對所有你名下的倉庫均不能訪問。


411 錯誤:

error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly
這個錯誤是因爲是由於上傳的包過大 HTTP 的頭出錯導致的。

解決方法:

需要設置http.postBuffer,設置爲50MB就可以了

git config http.postBuffer 524288000
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章