不能上传到码云上

$ git push test master
To gitee.com:yoyhm/git.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:yoyhm/git.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.

解决方法

## 1. 产生版本冲突,将远程的pull到本地
$ git pull origin master
## 如果出现以下问题
## ------------------------
$ git pull test master
From gitee.com:yoyhm/git
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
## ------------------------------
## 解决上面问题
## ------
$ git merge test/master --allow-unrelated-histories
## ------

## 2. 再次推送即可
$ git push -u test master

参考转 push本地代码到github出错

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐