最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】git push报错:remote rejected master master cannot lock ref refs/heads/master reference already exists

Git crifan 1332浏览 0评论
给GitHub上某仓库去git push,结果报错::
 git push
Enumerating objects: 100, done.
Counting objects: 100% (100/100), done.
Delta compression using up to 8 threads
Compressing objects: 100% (92/92), done.
Writing objects: 100% (100/100), 5.22 MiB | 21.06 MiB/s, done.
Total 100 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/crifan/popular_document_db_mongodb.git
! [remote rejected] master -> master (cannot lock ref 'refs/heads/master': reference already exists)
error: failed to push some refs to 'https://github.com/crifan/popular_document_db_mongodb.git'
remote rejected master master cannot lock ref refs/heads/master reference already exists
Git Push Error “cannot lock ref” “reference already exists” – Stack Overflow
cannot lock ref问题的解决_git_free_android的博客-CSDN博客
好像都在说branch的事情
此处没有建分支啊
git push: refs/heads/my/subbranch exists, cannot create – Stack Overflow
git – Failed to lock refs/heads/master – Stack Overflow
 git checkout master
Already on 'master'
Your branch is based on 'origin/master', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)
去试试
 git branch --unset-upstream

以及:
[email protected]  ~/dev/crifan/gitbook/gitbook_template/books/popular_document_db_mongodb   master  git status                 
On branch master
nothing to commit, working tree clean
[email protected]  ~/dev/crifan/gitbook/gitbook_template/books/popular_document_db_mongodb   master  git push  
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use


    git push --set-upstream origin master
再去试试
[email protected]  ~/dev/crifan/gitbook/gitbook_template/books/popular_document_db_mongodb   master  git push --set-upstream origin master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Everything up-to-date
[email protected]  ~/dev/crifan/gitbook/gitbook_template/books/popular_document_db_mongodb   master  git statusOn branch master
Your branch is up to date with 'origin/master'.


nothing to commit, working tree clean
[email protected]  ~/dev/crifan/gitbook/gitbook_template/books/popular_document_db_mongodb   master  git pushEverything up-to-date
去GitHub上看看
crifan/popular_document_db_mongodb: 主流文档型数据库:MongoDB
最后一次更新是 10小时之前,即昨天晚上的最后一次的push,实际上成功了?
不管了。总之现在push成功了。
【总结】
此处仓库去git push出错:
! [remote rejected] master -> master (cannot lock ref 'refs/heads/master': reference already exists)
error: failed to push some refs to
最后是:
git branch --unset-upstream
git push --set-upstream origin master
即可解决问题。

转载请注明:在路上 » 【已解决】git push报错:remote rejected master master cannot lock ref refs/heads/master reference already exists

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
92 queries in 0.118 seconds, using 20.59MB memory