git提交代码到远程仓库 git 未能顺利结束 (退出码 1)

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:\Users\Administrator.ssh\id_rsa): #不填直接回车

Enter passphrase (empty for no passphrase): #不设置密码直接回车

Enter same passphrase again: #不设置密码直接回车

Your identification has been saved in C:\Users\Administrator.ssh\id_rsa. #生成的密钥位置

Your public key has been saved in C:\Users\Administrator.ssh\id_rsa.pub. #生成的公钥位置

使用记事本打开C:\Users\Administrator.ssh\id_rsa.pub

复制上述文件中的内容到gitee -->设置 -->ssh公钥

git提交代码到远程仓库 git 未能顺利结束 (退出码 1)_第1张图片

  • 切换协议

使用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

你可能感兴趣的:(github)