混帐 1.8 : it push error: dst ref refs/heads/master receives from more than one src

标签 git

git 1.8 的另一个问题:

$ git push
error: dst ref refs/heads/master receives from more than one src.
error: failed to push some refs to 'gitosis@xxx.xx:xxx.git'

建议?它在升级到 1.8 之前一直有效。

$ git remote -v
origin  gitosis@xxx.xx:xxx.git (fetch)
origin  gitosis@xxx.xx:xxx.git (push)

谷歌搜索后我首先尝试了这个:

$ git push origin :refs/heads/refs/heads/master
remote: warning: Allowing deletion of corrupt ref.
To gitosis@xxx.xx:xxx.git
 - [deleted]         refs/heads/master

不知道那是什么以及它为什么损坏。

$ git pull
Already up-to-date.

$ git push
error: dst ref refs/heads/master receives from more than one src.
error: failed to push some refs to 'gitosis@xxx.xx:xxx.git'

仍然不工作,但 origin master 至少工作了:

$ git push origin master
Counting objects: 42, done.
To gitosis@xxx.xx:xxx.git
3e3fc87..6e11d2a  master -> master

好的,这样就解决了问题,但是问题的起因是什么?为什么 origin/master 突然损坏了?我对 git push origin :refs/heads/refs/heads/master 做了什么?

.git/config:

[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = gitosis@xxx.xx:xx.git
push = HEAD
[branch "master"]
remote = origin
merge = refs/heads/master

ls .git/refs/remotes/origin:

HEAD    master  refs

最后,现在我每次都必须执行 git push origin master。最烦人的是一些 repo 协议(protocol)与 git push 一起工作,但在大多数情况下我必须添加 origin master 但我不明白为什么,它可以是我一个人遇到这个问题。

最佳答案

出现此错误的另一种方法是,如果您不小心输入了两次要推送的分支的名称,即:

git push master otherBranch master moreBranches

产生这个错误。一旦您意识到自己已经完成,修复就很明显了:

git push master otherBranch moreBranches

关于混帐 1.8 : it push error: dst ref refs/heads/master receives from more than one src,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13373528/

相关文章:

git - 如何验证 git merge 不包含额外的更改?

git - 有没有办法让 git 为审查板创建补丁?

github repo 中的 Git 子模块

git - 更新后的 git hooks 似乎不起作用

git - src refspec ~ 不匹配任何

git - 如何使用集线器从命令行 merge PR?

git - Git中的FETCH_HEAD是什么意思?

git - 无法在 GitLab 5.0 中创建项目

git - 如何克隆项目并保持最新状态?

git - 如何删除github中的所有提交历史记录?