2009-11-11 147 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