您的位置:首页 > 其它

git出现的错误汇总及解决方法

2021-01-29 10:14 42 查看

目录

git错误汇总

错误一:Updates were rejected because the remote contains work that you do

执行命令:

git push -u origin master

出现错误:

! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'xxx.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.

原因分析:

因为我们在本地新建库后,与远程仓库的内容不一致导致的。为此在我向远程库推送的时候,要先进行pull,让本地新建的库和远程库进行同步。

解决方法:

# 注:这里master应该修改成自己push的仓库
git pull origin master // 把本地仓库的变化连接到远程仓库主分支
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐