前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >git提交代码到远程仓库 git 未能顺利结束 (退出码 1)

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

作者头像
周小董
发布2019-09-19 10:29:10
9.4K0
发布2019-09-19 10:29:10
举报
文章被收录于专栏:python前行者python前行者

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

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

Git 服务器已安装了, 客户端是TortoiseGit

代码语言:javascript
复制
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)

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

首先尝试

代码语言:javascript
复制
git push -f origin master

报错

代码语言:javascript
复制
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引起的,可以在客户端执行

代码语言:javascript
复制
改为最大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公钥

image.png
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


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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年09月18日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • ssh提交
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档