给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
好像都在说branch的事情
此处没有建分支啊
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
以及:
xxx@xxx ~/dev/crifan/gitbook/gitbook_template/books/popular_document_db_mongodb master git status On branch master nothing to commit, working tree clean xxx@xxx ~/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
再去试试
✘ xxx@xxx ~/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 xxx@xxx ~/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 xxx@xxx ~/dev/crifan/gitbook/gitbook_template/books/popular_document_db_mongodb master git pushEverything up-to-date
去GitHub上看看
最后一次更新是 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