(原)使用TortoiseGit提交代碼push的時候報錯:HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large


今天我想rk的sdk包里面的一些東西提交到我的git服務器上,結果,總是報錯,折騰了一下午,結果才解決。

首先看看我提交代碼的時候,報錯的信息:

git.exe push --progress "origin" master:master

Counting objects: 43142, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (25108/25108), done.
Writing objects: 100% (43142/43142), 824.64 MiB | 26.18 MiB/s, done.
Total 43142 (delta 14030), reused 43141 (delta 14030)
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
Everything up-to-date


git did not exit cleanly (exit code 1) (717417 ms @ 2016/11/1 15:57:57)

 網上搜了一下,我以為跟上次我pull的時候報錯git clone: error: RPC failed; result=18, HTTP code = 200 解決辦法的解決方法一樣哦,結果我始終修改http.postBuffer的大小,改大改小都試過,但提交到一定大小以后,老是會出現上述的報錯信息。

后面結合http://stackoverflow.com/questions/7489813/github-push-error-rpc-failed-result-22-http-code-413中的內容,以及http://blog.csdn.net/passion_wu128/article/details/8234901博文的內容,我了解到上述的這種報錯:

這跟Git的postBuffer變量值沒有關系。

(如果code = 411,則是由postBuffer引起的,可以在客戶端執行

git config --global http.postBuffer 52428800,改為最大50M)

 

解決方法其實能通過ssh提交來解決,所以實在沒辦法,我使用ssh來提交,而不用之前的http方法,最后證明可行。

 

這里記錄下使用ssh提交代碼和生成公鑰的過程。

這個過程,我借鑒http://www.cnblogs.com/ChenRihe/p/Git_TortoiseGit_SSH.html的部分內容做參考:

1.如果沒配置過用戶名和密碼(配過也再來一次咯):

git config --global user.name "John Doe"
git config --global user.email "johndoe@doebrothers.com"

下圖抄的..

 

2.創建SSH和復制公鑰到剪切板(如復制以下代碼執行出現參數過多提示,一般由於字符問題,需自己手打以下代碼)

ssh-keygen –t rsa –C "johndoe@doebrothers.com"

clip < ~/.ssh/id_rsa.pub

下圖抄的..

 

3.生成ssh公鑰以后,我們先cat一下公鑰,在git bash中輸入cat ~/.ssh/id_rsa.pub,這個時候會顯示出我們生成的公鑰,這時候拷貝公鑰,在我們git的賬戶中添加ssh就OK。

 

4.設置remote url,在git bash中輸入:

git remote set-url origin git@github.com:GitRepoName.git

github.com是你的服務器域名,例如你用開源中國的碼雲的話,這個地方就是git@git.oschina.net

GitRepoName.git是git倉庫名。

5.提交代碼,git push origin master

 

使用ssh提交代碼,比使用http不但能解決413的大文件報錯,同時還能提高提交代碼的速度,從我提交的速度來看,他最少能夠提升100%的速度,所以還是使用ssh吧。

 

轉載注明出處:http://www.cnblogs.com/lihaiping/p/6021813.html

 


免責聲明!

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



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