本地库进行更改后,需要推送更新到码云
输入:git push gitee master
没有推送成功,报错如下:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:XXX/XXXXt.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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 pull 先拉取,仍然报错:refusing to merge unrelated histories
查了一下,有人说是因为本地仓库和远程仓库是两个仓库导致的,需要在 git pull命令后面使用
--allow-unrelated-history,告诉系统运行合并不相关的历史内容
输入git pull gitee master --allow-unrelated-histories
输入说明,然后esc, :wq 回车
再次输入:git push gitee master
则可以推送成功。