从svn仓库克隆git仓库,结果是一个没有文件和远程分支的git仓库。

42

使用工作中的SVN仓库

我正在创建一个git repo与svn repo进行交互。svn存储库已设置并正常工作,其中包含一个基本的README文件的单个提交。

检出正常运行:

tchalvak:~/test/svn-test$ 
svn checkout --username=myUsernameHere http://www.url.to/project/here/charityweb/
A    charityweb/README
Checked out revision 1.

git-svn克隆svn仓库失败

尝试使用git克隆仓库时,第一步没有显示任何错误...

tchalvak:~/test$ 
git svn clone -s --username=myUserNameHere http://www.url.to/project/here/charityweb/
Initialized empty Git repository in /home/tchalvak/test/charityweb/.git/
Authentication realm: <http://www.url.to/project/here:80> Charity Web
Password for 'myUserNameHere': 

...但会生成一个无用的文件夹,其中不包含任何文件、分支或提交记录:

tchalvak:~/test$ ls
charityweb
tchalvak:~/test$ cd charityweb/
tchalvak:~/test/charityweb$ ls
tchalvak:~/test/charityweb$ ls -al
total 12
drwxr-xr-x 3 tchalvak tchalvak 4096 2010-04-02 13:46 .
drwxr-xr-x 4 tchalvak tchalvak 4096 2010-04-02 13:46 ..
drwxr-xr-x 8 tchalvak tchalvak 4096 2010-04-02 13:47 .git
tchalvak:~/test/charityweb$ git branch -av
tchalvak:~/test/charityweb$ git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
tchalvak:~/test/charityweb$ git fetch
fatal: Where do you want to fetch from today?
tchalvak:~/test/charityweb$ git rebase origin/master
fatal: bad revision 'HEAD'
fatal: Needed a single revision
invalid upstream origin/master
tchalvak:~/test/charityweb$ git log
fatal: bad default revision 'HEAD'

我该如何获得可以提交更改的内容?我预期在这个过程中做错了什么,但是具体是什么呢?

1个回答

68

您使用了 -s 选项来执行 git svn clone,但从您的示例中看来,似乎您的 Subversion 仓库并没有使用标准布局(即在仓库根目录下包含 trunk、branches 和 tags 目录)。

如果是这种情况,请不要带上 -s 进行克隆。


谢谢,确实解决了问题。我已经有一段时间没有使用svn了,所以我没有意识到README在根目录下表明存储库布局是非标准的。应该意识到这一点,很高兴你能发现。 - Kzqai

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接