解决error: failed to push some refs to 'xxxx'

copy from :https://blog.csdn.net/k_young1997/article/details/90489734

今天将项目修改了一部分,然后用 git push origin master 向远程仓库推送的时候报如下错误:

error: failed to push some refs to ‘https://github.com/ZJyoung1997/JZShop.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.
1
2
3
4
5
6
原因是远程仓库中的文件和我们本地的仓库有差异,例如你的远程仓库有个文件Readme. md,但是本地仓库却没有,就可能会出现这种情况。 我的就是远程仓库中有Readme. md文件,而本地仓库中没有该文件造成的。还有就是因为平时在协会中,用协会电脑开发,回到寝室后又会用自己的电脑开发,这可能也是导致这种问题的原因。这种情况有解决办法,就是将本地仓库直接干掉,然后重新从远程clone一个,但是这样显然太麻烦了,可以用合并分支的方法

解决办法:
git pull --rebase origin master
1
git pull命令用于从另一个存储库或本地分支获取并集成(整合),取回远程主机某个分支的更新,再与本地的指定分支合并。

如果报如下错误,也可以用 git pull 命令

fatal: ‘master‘ does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

1
2
3
4
5
6
用 git pull origin master --allow-unrelated-histories 解决
————————————————
版权声明:本文为CSDN博主「Been_You」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/k_young1997/article/details/90489734

解决error: failed to push some refs to 'xxxx'

原文地址:https://www.cnblogs.com/Oude/p/12304460.html

时间: 2025-01-05 04:17:01

解决error: failed to push some refs to 'xxxx'的相关文章

github 如何解决error: failed to push some refs

错误 error: failed to push some refs to 'https://github.com/whitclass/scrapy-spider.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

Git error (failed to push some refs)解决

当修改了本地仓库后 提交代码时, 用 git push 提示以下错误 error:failed to push some refs to ... Dealing with "non-fast-forward" errors From time to time you may encounter this error while pushing: $ git push origin master To ../remote/ ! [rejected] master -> master

如何解决git====push 过程中出现的。error: failed to push some refs

当我们在利用git  push 文件到仓库时出现了一下问题: ! [rejected] master -> master (fetch first)error: failed to push some refs to '[email protected]:yaogengzhu/ajax.git'hint: Updates were rejected because the remote contains work that you dohint: not have locally. This i

错误:error: failed to push some refs to 'https://github.com/pzq7025/KG.git'的解决办法

一.问题在进行[git push orgin master]的时候出现如下错误 ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/pzq7025/KG.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counter

Git本地分支版本过低导致的push错误 error: failed to push some refs to ... 及后续amend

今天在用git的时候遇到了一个问题.在想远程分支push的时候,出现了下面的错误: ! [remote rejected] master -> refs/for/master (change 144 closed) error: failed to push some refs to ... 检查了一下发现是因为本地分支的版本相比远程分支的版本低. 解决的过程中有如下问题: 1.(不建议使用)直接在当前分支pull了一下,合并的时候发现有冲突,解决后commit --amend出错,大意是"

提交代码报错 error: failed to push some refs to

在本人想把本地的分支推送到远程仓库时,突然出现了错误提醒error: failed to push some refs to....心里一咯噔,推不上去这还得了,手比脑快地就去google了一下. 然后就发现,这个error发生的情况竟然还挺多样化.鉴于自己搜到的页面,都是分散的答案,所以在此做个总结,以免日后又碰到这类错误,烂记性又促使我花费一样的时间去寻找一样的答案. 分支名不完整 emmm,这个错误大概是最难发现的了,不是说难度系数高,而是大家都把以本地master与远程master为例去

git push报错error: failed to push some refs to '[email protected]:

$ git push -u origin master To [email protected]:xxx/xxx.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '[email protected]:xxx/xxx.git' hint: Updates were rejected because the remote contains work that you do hint:

git push origin master出错:error: failed to push some refs to

1.输入git push origin master 出错:error: failed to push some refs to 那是因为本地没有update到最新版本的项目(git上有README.md文件没下载下来) 本地直接push所以会出错. 2.所以本地要输入git pull 然后出现的英语提示'git pull <repository> <refspec>'显示要选择远程分支 2.就试试指定目标到远程分支 输入git pull origin 出现提示 but did n

【git】error: failed to push some refs to

在使用git 对源代码进行push到gitHub时可能会出错 error: failed to push some refs to ... 出现错误的主要原因是github中的README.md文件不在本地代码目录中 可以通过如下命令进行代码合并 git pull --rebase origin master 执行上面代码后可以看到本地代码库中多了README.md文件 再执行语句 git push -u origin master即可完成代码上传到github 如何把本地项目上传到Github