git推送报错“! [rejected] master -> master (fetch first)解决办法

申屠泉
2023-12-01

git推送报错“! [rejected] master -> master (fetch first)"

今天上传git的时候出现了

To git@git.oschina.net:yangzhi/hello.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@git.oschina.net:yangzhi/hello.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushin
hint: to the same ref. You may want to first merge the remote changes (e.g.
hint: 'git pull') before pushing again.

导致该错误的原因是我和同事在同一时间段上传了git(在同一项目下,而且他先于我上传)
解决办法:
先拉取项目,然后再推送

 类似资料: