git提交程式碼到遠程倉庫 git 未能順利結束 (退出碼 1)

  • 2019 年 10 月 5 日
  • 筆記

版權聲明:本文為部落客原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接和本聲明。

本文鏈接:https://blog.csdn.net/xc_zhou/article/details/100994846

Git 伺服器已安裝了, 客戶端是TortoiseGit

From git.gajah.com.sg:bin.hua/inkcase3510_setup  = [up to date]      master     -> origin/master  You asked to pull from the remote 'origin', but did not specify  a branch. Because this is not the default configured remote  for your current branch, you must specify a branch on the command line.    git 未能順利結束 (退出碼 1) (2562 ms @ 2014-8-25 14:48:31)

其實最主要的原因就是文件太大

首先嘗試

git push -f origin master

報錯

error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413  fatal: the remote end hung up unexpectedly  fatal: the remote end hung up unexpectedly  Everything up-to-date

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

改為最大50M  git config --global http.postBuffer 52428800    windows:  在 .git/config 文件中加入  [http]  postBuffer = 524288000  linux:  git config http.postBuffer 524288000

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

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

ssh提交

git客戶端輸入ssh-keygen -t rsa -C 「你的郵箱地址」 Enter file in which to save the key (C:UsersAdministrator.sshid_rsa): #不填直接回車

Enter passphrase (empty for no passphrase): #不設置密碼直接回車

Enter same passphrase again: #不設置密碼直接回車

Your identification has been saved in C:UsersAdministrator.sshid_rsa. #生成的密鑰位置

Your public key has been saved in C:UsersAdministrator.sshid_rsa.pub. #生成的公鑰位置

使用記事本打開C:UsersAdministrator.sshid_rsa.pub

複製上述文件中的內容到gitee –>設置 –>ssh公鑰

  • 切換協議

使用git remote -v查看當前地址 使用git remote set-url origin ssh://[email protected]:test/ionic3_demo.git切換協議

隨後跳出此程式碼則設置成功You』ve successfully authenticated, but GitHub does not provide shell access

  • 嘗試git push提交報錯的話使用git push -u origin master

參考:https://bbs.csdn.net/topics/390870192 https://blog.csdn.net/zhouheng2018/article/details/84109406 https://www.cnblogs.com/feiyujun/p/7755764.html https://www.cnblogs.com/lihaiping/p/6021813.html https://blog.csdn.net/raogeeg/article/details/87617698 https://www.cnblogs.com/wangkun1993/p/8514015.html


ssh提交: https://blog.csdn.net/fangjial/article/details/92357236 https://blog.csdn.net/ligaoming_123/article/details/81297305