2009-11-11 128 views
4

是否可以克隆有多個修訂版本的git倉庫?我們試圖做到這一點,並在第1000次提交後執行GC並退出,使克隆處於不可用狀態。git-svn問題

r998 = a5cb4f6a377b0ca80cd95d73b0e32f0552b9cdfd (git-svn) 
M trunk/asdf/asdf.java 
r999 = a87b06ae8aa497bb28c294b7ff8668ce2e4c8fcc (git-svn) 
D tags/sdafasdf/asdfasdf.java 
r1000 = 20b383d138499eee4f121079ae059458f3facc94 (git-svn) 
Auto packing your repository for optimum performance. You may also 
run "git gc" manually. See "git help gc" for more information. 
Counting objects: 18103, done. 
Compressing objects: 61% (10590/17116)  7116) 
Compressing objects: 100% (17116/17116), done. 
Writing objects: 100% (18103/18103), done. 
Total 18103 (delta 9301), reused 0 (delta 0) 
Removing duplicate objects: 100% (256/256), done. 
[email protected]:~# 

試圖通過鍵入命令繼續結賬再次導致以下:

[email protected]:~/repo# git svn clone https://host/svn/repo 
Remote ref refs/remote/git-svn is tracked by 
    "svn-remote.svn.fetch=:refs/remotes/git-svn" 
and 
    "svn-remote.svn.fetch=:refs/remotes/git-svn" 
Please resolve this ambiguity in your git configuration file before continuing 

回答

5

找出答案。在使用ubuntu自帶的git版本時必定會有某種錯誤。下面一行在新創建的.git/config文件中出現過兩次:

svn-remote.svn.fetch=:refs/remotes/git-svn 
svn-remote.svn.fetch=:refs/remotes/git-svn 

刪除重複的過程讓我輸入一個git svn fetch這似乎繼續結賬。

+1

我想這是因爲你試圖重新運行的命令是「svn clone」,它基本上是「svn init」,後面是「svn fetch」。所以我應該說「重新運行git svn fetch」。我有這麼多的麻煩,所以我養成了一直習慣初始化然後手工抓取的習慣。 – Lachlan 2009-11-17 06:43:31

+0

我認爲你是對的。我不得不質疑git命令將配置文件中的某些內容放入實際上已損壞的情況。如果一個新的git用戶意外地輸入了錯誤的命令,它不應該完全破壞版本庫。 (除非中斷,這是他們試圖做的) – corydoras 2009-11-19 22:19:39

1

是。它應該工作得很好。我使用以下命令克隆了Mono項目存儲庫(超過140k版本):

$ mkdir mono 
$ cd mono 
$ git init 
$ git svn init svn+ssh://[email protected]/source 
$ git config svn-remote.svn.fetch trunk/mono:refs/remotes/git-svn/trunk 
$ git config svn-remote.svn.branches branches/*/mono:refs/remotes/git-svn/branches/* 
$ git config svn-remote.svn.tags tags/*/mono:refs/remotes/git-svn/tags/* 
$ git fetch git://repo.or.cz/mono.git refs/heads/master:refs/remotes/git-svn/trunk refs/heads/branches/*:refs/remotes/git-svn/branches/* refs/tags/*:refs/remotes/git-svn/tags/* 
$ git reset --hard git-svn/trunk 

並且一切正常。這與你所做的相似嗎?

+0

哈哈,這就是我所做的一切。這看起來高於我的git能力水平(: – corydoras 2009-11-16 21:56:51

+0

所有額外的參數只是爲了支持從顛覆所有分支和標籤是不同的分支在git。你可以跳過這些。沒有魔術介入:) – Gonzalo 2009-11-16 22:05:15

1

這件事發生在我身上。我只是重新運行完全相同的git命令,並從停止的地方繼續。最終它會結束並且一切正常。

編輯:如果在運行git svn clone ...時發生此問題,那麼當您重新運行該命令時,您想要將clone替換爲fetch

+0

我試過了,它失敗並顯示以下消息:錯誤:關鍵字svn-remote.svn.fetch::refs/remotes/git-svn的多個值 – l0b0 2009-11-12 09:13:34

+1

檢查.git/config文件的[svn-remote「svn」]部分並確保提取條目(或條目)看起來不錯。 – Lachlan 2009-11-13 01:00:02

+0

重新運行該命令會給出與'l0b0'相同的錯誤。 – corydoras 2009-11-16 21:56:16