[661]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提交

Gitlab 创建SSH秘钥

ssh-keygen -t rsa -C '你注册的邮箱'
//或
ssh-keygen -t ed25519 -C "你注册的邮箱"
//或
ssh-keygen -o -t rsa -b 4096 -C "你注册的邮箱"

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公钥

image.png

  • 切换协议

使用git remote -v查看当前地址
使用git remote set-url origin ssh://git@github.com:test/ionic3_demo.git切换协议

  • 测试连接ssh -T git@github.com

随后跳出此代码则设置成功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
https://blog.csdn.net/tangxinzhuan/article/details/71515924


ssh提交:
https://blog.csdn.net/fangjial/article/details/92357236
https://blog.csdn.net/ligaoming_123/article/details/81297305
https://www.jianshu.com/p/dd7d675f80fd

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周小董

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值