2011-08-02 41 views
8
$ git svn clone -s http://a_repo local_dir (by default this brings me r1) to hdd 
    Initialized empty Git repository in d:/Temp/local_dir/.git/ 
    r1 = some_SHA (refs/remotes/trunk) 

    $ cd local_dir 
    $ git svn rebase 
    fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree. 
    Use '--' to separate paths from revisions 
    log --no-color --no-decorate --first-parent --pretty=medium HEAD: command returned error: 128 

我該如何檢查回購?git svn模棱兩可的論點'HEAD'

我也嘗試過沒有重新綁定,使用fetch,但它一次只帶來一個修訂。我們有幾千次提交,按照這個速度,複製存儲庫需要幾天的時間。

+0

你的意思是'混帳SVN clone'帶來了一個修訂版?你正在使用'-s',你的SVN回購真的在標準佈局中嗎?通常,'git svn clone'也應該創建一個工作副本。 – eckes

回答

9

如果你只有一個提交出SVN倉庫,我認爲SVN倉庫不是標準佈局,但你告訴git svn它是。

git svn clone http://a_repo local_dir 

(即沒有0​​標誌)應該能夠克隆SVN回購。如果這樣,請重試克隆並按照docs of git-svn中的說明指定您的中繼,標記和分支目錄。

+0

我的存儲庫採用標準佈局。我也嘗試通過-T,指定trunk作爲參數,同樣的事情。我記得在某處讀過,如果你通過'fetch'啓動一個svn克隆,那麼你只能通過'fetch'繼續。也許這就是爲什麼抓取「有效」(每次調用只獲得一個修訂版本)的原因?因爲一個git克隆是一個init,然後是一個提取? – Senthess

+0

@Senthess:一個簡單的'git svn clone http:// a_repo local_dir'(即沒有任何repo-layout-info-params)是否工作?另外,'git svn fetch'應該提供所有的修訂版本,而不僅僅是一個。你做一個'git svn clone'進入一個沒有回購的新目錄,對嗎? – eckes

+0

我不再工作了,不幸的是我無法測試這個。我會在早上寫下結果。我克隆到一個新的目錄(克隆之前沒有文件存在)。 – Senthess

2
git svn clone [your-repo-url] -s 
# OR 
git svn clone [your-repo-url] -T [your-trunk-dir] -t [your-tags-dir] -b [your-branches-dir] 

如果不指定-r標誌(如上),那麼你需要

git svn fetch 
2

當你克隆分支而不是整個SVN倉庫發生此錯誤。

如果回購URL看起來像https://svnserver/project/repo/trunkhttps://svnserver/project/branches/pre-something,改變克隆命令:

git svn clone https://svnserver/project/repo --stdlayout 
相關問題