2012-07-06 60 views
7

雖然做git svn clone -s https://svn.example.com/repo/我收到了以下的輸出:混帳svn的克隆失敗「致命的:不是有效的對象名稱」

r3073 = a6132f3a937b632015e66d694250da9f606b8333 (refs/remotes/trunk) 
Found possible branch point: https://svn.example.com/repo/trunk => https://svn.example.com/repo/branches/v1.3, 3073 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
fatal: Not a valid object name refs/remotes/tags/Sync Controllers 
cat-file commit refs/remotes/tags/Sync Controllers: command returned error: 128 

運行git branch -a給出:

remotes/tags/Sync%20Controllers 
remotes/tags/v1.1 
remotes/trunk 
remotes/v1.2 

我認爲問題是, 「遙控器/標籤/同步控制器」!=「遙控器/標籤/同步%20控制器」。

+0

另請參閱: https://bugs.launchpad.net/ubuntu/+source/git/+bug/786942 – kenorb 2012-07-19 11:03:49

+0

相關:http://stackoverflow.com/questions/7584605/git-svn-dcommit-因存儲庫名稱包含空間而失敗在那裏有可用的補丁。 – kenorb 2012-10-26 08:25:30

回答

12

SVN上的標籤中有一個空格,但git中的標籤將此空間轉換爲%20(URL編碼)。爲了解決這個問題只需手動添加一個新的標籤與逐字名稱:

cd .git/refs/remotes/tags/ 
mv Sync%20Controllers Sync\ Controllers 

然後再次運行git svn clone命令。

(通常你應該這樣做與git tag OLDTAG NEWTAG但混帳是不是讓我來定義與空間的標籤。標籤文件是包含了有關提交的哈希值簡單的文本文件。)

+2

然而,我試過這個解決方案,我得到以下錯誤: '致命的:引用具有無效的格式:'refs/remotes/tags/WITH SPACE''。如何解決這個問題? – 2014-06-25 07:28:40

+0

(我使用的是git 1.8.3.msysgit.0) – 2014-06-25 07:30:14

+0

這對我來說也是一個帶有'〜'字符的標籤。謝謝。 – Flimzy 2014-08-18 10:01:40

3

您可以使用git-svn服務器端替代方案SubGit以避免許多git-svn轉換問題。

我是SubGit的開發者,可以說我們在解決像上面那樣的字符翻譯問題方面做了很多工作;在這種情況下,標籤將被轉換爲refs/tags/Sync+Controllers標籤。

請注意,git-svn已將Subversion標記翻譯爲分支而不是標記。

+0

我必須在服務器上安裝SubGit或者它沒有必要?如果我沒有管理員訪問我的svn回購怎麼辦? – kenorb 2012-10-26 08:24:21

+0

使用SubGit 2.0時,您不必具有對存儲庫的管理訪問權限。您需要啓用pre-revprop-change hook才能獲得全功能的作者映射,但有可能已啓用。查看http://subgit.com/eap/瞭解更多詳情。 – 2012-11-16 17:35:16

0

我相信空間問題在Git> = 1.8.0(參見:#786942)中是固定的。

所以你應該升級它。

我測試過它,它似乎在最近的git版本中工作。

見GitHub的主頁:https://github.com/git/git

+3

我使用1.8.5.2,跑進這個問題 – krinker 2014-09-12 13:54:50

+0

,做你認爲這是關係到你的分支/標籤名稱的空間或一些特殊字符等? – kenorb 2014-09-12 14:10:17

+0

我已經使用Git = 1.8.3.1,SVN = 1.7.14和svn2git = 2.3.2 相關的各種SVN分支名稱空間看到這個問題了。 – jplandrain 2015-11-16 15:11:16

1

我今天就遇到了這個問題,並認爲這是分支,它包含了步伐,這並不重要,我只是跑

git branch -r -d partialPayment%202.4 

並重新運行git svn fetch 它跳過當前分支並繼續抓取下一個分支。

相關問題