从 svn 存储库克隆 git 存储库,导致无文件、无远程分支的 git 存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2568321/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cloning git repository from svn repository, results in file-less, remote-branch-less git repo
提问by Kzqai
Working SVN repo
工作 SVN 存储库
I'm starting a git repo to interact with a svn repo. The svn repository is set and working fine, with a single commit of a basic README file in it.
我正在启动一个 git repo 来与 svn repo 进行交互。svn 存储库已设置并运行良好,其中包含一个基本 README 文件的单次提交。
Checking it out works fine:
检查它工作正常:
tchalvak:~/test/svn-test$
svn checkout --username=myUsernameHere http://www.url.to/project/here/charityweb/
A charityweb/README
Checked out revision 1.
Failed git-svn clone of svn repo
svn repo 的 git-svn 克隆失败
When I try to clone the repository in git, the first step shows no errors...
当我尝试在 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':
...but results in a useless folder, containing no files, no branches, and no commits:
...但结果是一个无用的文件夹,不包含文件、分支和提交:
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'
How do I get something I can commit back to? I expect I'm doing something wrong in this process, but what?
我怎样才能得到我可以承诺的东西?我希望我在这个过程中做错了什么,但是什么?
回答by Greg Bacon
You used the -s
option to git svn clone
, but from your example, it doesn't appear that your Subversion repository is using the standard layout (i.e., trunk, branches, and tags directories at the repository root).
您使用了-s
选项git svn clone
,但从您的示例来看,您的 Subversion 存储库似乎并未使用标准布局(即存储库根目录下的主干、分支和标签目录)。
If that's the case, clone without -s
.
如果是这种情况,请在没有-s
.