Android git上传代码到码云上。出现的问题汇总

参考文章:Git提交数据失败 error: failed to push some refs to ‘https://github.com/XXXXXXX/gif.git’

码云设置 ssh

error: failed to push some refs to ‘https://github.com/XXXXXXX/gif.git

1.git remote -v

查看是否连接远处地址

xu:aofeiapp xiaokai$ git remote -v
origin  https://gitee.com/xxxxx.git (fetch)
origin  https://gitee.com/xxxxx.git (push)

如果有,不是想要的项目上传地址 git remote rm origin 删除地址,
git remote add origin https://gitee.com/xxxxx.git 添加上传地址

  1. git push -u origin master

    Username for ‘https://gitee.com/xxxxx.git
    ! [rejected] master -> master (fetch first)
    error: failed to push some refs to ‘https://gitee.com/xxxxx.git
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., ‘git pull …’) before pushing again.
    hint: See the ‘Note about fast-forwards’ in ‘git push --help’ for details.

错误的主要原因是git仓库上已经存在readme文件,故在提交时可能会存在冲突,这时您需要选择的是保留线上的文件或者舍弃线上的文件,如果您舍弃线上的 文 件,则在推送时选择强制推送,强制推送需要执行下面的命令

git push origin master -f

如果您选择保留线上的readme文件,则需要先执行

git pull origin master

fatal: The remote end hung up unexpectedly

报错内容如下

xu:aofeiapp xiaokai$ git push -u origin master
Counting objects: 6958, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6104/6104), done.
Writing objects: 100% (6958/6958), 228.90 MiB | 341.00 KiB/s, done.
Total 6958 (delta 3810), reused 0 (delta 0)
error: RPC failed; HTTP 502 curl 22 The requested URL returned error: 502 Bad Gateway
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

参考文章:error: RPC failed; HTTP 500 curl 22 The requested URL returned error: 500 Internal Server Error

查找网上的原因是这次push的内容过大。

解决方法:1、我的解决方案是强制推送

yanmin:notes yanmin$ git push -u origin master -f
Counting objects: 42, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (42/42), done.
Writing objects: 100% (42/42), 1.22 MiB | 0 bytes/s, done.
Total 42 (delta 23), reused 0 (delta 0)
To git@gitee.com:XXXXXX.git
  452afa2..09a9ae4  master -> master
Branch master set up to track remote branch master from origin

2.、我这边用的http协议,你可以换成ssh协议,也能解决这个问题。

git remote set-url origin git@gitee.com:XXXXXX.git

这两种方法都测试,发现,还是不可以。

xu:aofeiapp xiaokai$ git push -u origin master
Counting objects: 6958, done.
Delta compression using up to 4 threads.
Connection to gitee.com closed by remote host.
fatal: The remote end hung up unexpectedly
Compressing objects: 100% (6104/6104), done.
error: failed to push some refs to 'git@gitee.com:XXXXXX.git'

当前仍然没有解决。解决后再贴哈桑新的解决方法;

使用git与github/码云管理代码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值