学无先后,达者为师

网站首页 编程语言 正文

git本地提交到远程仓库报错error: failed to push some refs to

作者:布偶乱跑 更新时间: 2022-04-10 编程语言

今天在本地新建了个项目,在码云上也建了个仓库,想从本地推送到码云,但是git push -u origin master,报错:

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

查找后,使用:git pull --rebase origin master 解决
rebase与merge区别:

rebase 会把你当前分支的 commit 放到公共分支的最后面,所以叫变基。
merge 会把公共分支和你当前的commit 合并在一起,形成一个新的 commit 提交

原文链接:https://blog.csdn.net/weixin_44634372/article/details/119795326

栏目分类
最近更新