2013-04-28 25 views
4

當推主分支到遠程目標:TMP警告:備份裁判時混帳推

git push tmp master 

我得到這個消息

warning: Duplicated ref: refs/heads/master 

推還是可以成功的。

但這條消息是什麼意思? 我如何找到更多關於此的詳細日誌信息?

這是我的.git/config中

[core] 
    repositoryformatversion = 0 
    filemode = false 
    bare = false 
    logallrefupdates = true 
    symlinks = false 
    ignorecase = true 
    hideDotFiles = dotGitOnly 
[remote "origin"] 
    fetch = +refs/heads/*:refs/remotes/origin/* 
    url = [email protected]:testuser/myproject.git 
[branch "master"] 
    remote = origin 
    merge = refs/heads/master 
[remote "tmp"] 
    url = [email protected]:testuser/myproject.git 
    fetch = +refs/heads/*:refs/remotes/tmp/* 

和我的Git版本是1.7.11.msysgit.1


show-refls-remote信息的TMP

git show-ref

$ git show-ref 
1696d17186db41cc70876f76f943e18ea4708ad3 refs/heads/master 
3c51688bf27e712001db1b6e9f316748634643c4 refs/remotes/origin/HEAD 
3c51688bf27e712001db1b6e9f316748634643c4 refs/remotes/origin/master 
1696d17186db41cc70876f76f943e18ea4708ad3 refs/remotes/tmp/master 

$ git ls-remote tmp 
warning: Duplicated ref: refs/heads/master 
1696d17186db41cc70876f76f943e18ea4708ad3  HEAD 
1696d17186db41cc70876f76f943e18ea4708ad3  refs/heads/master 

$ git ls-remote origin 
3c51688bf27e712001db1b6e9f316748634643c4  HEAD 
3c51688bf27e712001db1b6e9f316748634643c4  refs/heads/master 

輸出的packed-refs上TMP

$ git show-ref 
warning: Duplicated ref: refs/heads/master 
1696d17186db41cc70876f76f943e18ea4708ad3 refs/heads/master 

內容在裸回購myproject.gitfind .

# pack-refs with: peeled 
3c51688bf27e712001db1b6e9f316748634643c4 refs/heads/master 
3c51688bf27e712001db1b6e9f316748634643c4 refs/heads/master 

輸出。 objects文件夾中有太多的子文件,所以我不粘貼它們。

$ find . 
. 
./branches 
./packed-refs 
./objects 
./HEAD 
./info 
./info/exclude 
./config 
./description 
./refs 
./refs/tags 
./refs/heads 
./refs/heads/master 
./hooks 
./hooks/commit-msg.sample 
./hooks/update.sample 
./hooks/pre-commit.sample 
./hooks/prepare-commit-msg.sample 
./hooks/post-update.sample 
./hooks/pre-rebase.sample 
./hooks/post-receive 
./hooks/pre-applypatch.sample 
./hooks/update 
./hooks/applypatch-msg.sample 

回答

5

IIRC,這意味着你莫名其妙地結束了創建具有名稱主裁判另一個,但不生活在正常的位置。有幾次我看到這是因爲我在搞管道命令,並沒有提供指令預期的參考(refs/heads/master)的完整路徑。首先,讓我們本地資源庫上最新與用遙控器:

git fetch --all 

檢查你的本地庫先用:

git show-ref | grep -i master 

-i在那裏,因爲你是在Windows上,並區分大小寫可能是一個問題。我懷疑你可能在列表中看到類似refs/master的東西。這個想法是,有一個名字可以通過兩種方式來解決。 refs/remotes/origin/masterrefs/remotes/tmp/master都可以,因爲它們的命名空間正確。

如果不把任何東西,檢查遠程:

git ls-remote url://to/remote/repo.git | grep master 

我懷疑的問題是在你的本地倉庫。對於本地存儲庫中,您可以通過update-ref刪除裁判:

git update-ref -m 'remove duplicate ref' -d <duplicate ref> 

哪裏<duplicate ref>是額外的一個你從show-ref命令找到。 分行存放於refs/heads。小心不要刪除refs/heads/master

如果是遙控器上,你應該能夠通過刪除重複:

git push origin :<duplicate ref> 

哪裏<duplicate ref>是額外的一個通過上述ls-remote命令找到。 再次,在這裏小心。請勿使用masterrefs/heads/master

如果可能,請更新您的問題,輸出爲git show-refgit ls-remote。另外,我可以在評論中引導您閱讀,以確保您不會丟失任何數據。

現在我們看到填充裁判是罪魁禍首

所以問題是,packed-refs有不止一個行引用的主人。我不完全確定這是怎麼回事,但我懷疑有一個允許它滑過的git版本。 A git gc將導致packed-refs被重寫,所以我只需在您的tmp遙控器上執行此操作。

+0

感謝您的回覆。我添加了一些細節信息,似乎tmp有一個重複的參考。我應該刪除那個裁判嗎? – txworking 2013-05-02 03:34:54

+0

你有直接訪問tmp嗎?我不認爲我們可以通過遠程操作解決這個問題。如果你有直接訪問權限,那麼我們來做一些事情。首先,進入該回購併運行'git show-ref'。我想它會向我們展示與'git ls-remote'相同的東西,但讓我們來看看。其次,運行「查找」。在裸倉庫(myproject.git)中。最後,輸出packed-refs並用這些輸出更新你的答案。 – jszakmeister 2013-05-02 10:10:51

+0

僅供參考,考慮到'ls-remote'的輸出,我們可能會刪除'refs/heads/master'(通過'git push'或'git update-ref' - 後者將需要訪問服務器)在tmp上,然後讓你重新推動你的工作樹的主人。但我想確保沒有別的錯誤。順便說一句,在tmp遠程上安裝了什麼版本的git? – jszakmeister 2013-05-02 10:11:14

相關問題