gitte远程仓库修改后,本地没有更新,本地与远程仓库不一致
问题 :gitte远程仓库修改后,本地没有更新,本地与远程仓库不一致
现象:
[cxq@iZwz9fjj2ssnshikw14avaZ rpc]$ git push
Username for 'https://gitee.com': beihangya
Password for 'https://beihangya@gitee.com':
To https://gitee.com/beihangya/rpc.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/beihangya/rpc.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 merge 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、拉取远程更改:
首先从远程仓库拉取最新的更改并合并到本地:
git pull origin master
如果有冲突,需要手动解决冲突。
2、解决冲突:
如果拉取过程中出现冲突,根据提示解决冲突
3、再次推送:
解决冲突并合并远程更改后,再次尝试推送:
git pull origin master