gitee本地上传仓库失败

git 推送到本地仓库

$ git add .
$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.

遇到了问题,根据提示的错误信息,进行尝试

$ git push --set-upstream origin master
To https://gitee.com/***/notpad.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/***/notpad.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 branch --set-upstream-to=origin/master
branch 'master' set up to track 'origin/master'.

使用git pull 获取仓库代码也显示失败

$ git push -u origin master
To https://gitee.com/***/notpad.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/***/notpad.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

后来参考了某个博主的方法,发信是远程和本地仓库内容和分支不统一导致的,发现只有read文件不一样

$ git pull --rebase origin master
From https://gitee.com/***/notpad
 * branch            master     -> FETCH_HEAD
Successfully rebased and updated refs/heads/master.

之后进行git push 成功了

 git push origin master
Enumerating objects: 636, done.
Counting objects: 100% (636/636), done.
Delta compression using up to 8 threads
Compressing objects: 100% (613/613), done.
error: RPC failed; curl 7 Recv failure: Connection was reset
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (635/635), 69.78 MiB | 368.00 KiB/s, done.
Total 635 (delta 50), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值