Cloning git repository from svn repository, results in file-less, remote-branch-less git repo

Kzqai picture Kzqai · Apr 2, 2010 · Viewed 12.7k times · Source

Working SVN repo

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.

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

When I try to clone the repository in git, the first step shows no errors...

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?

Answer

Greg Bacon picture Greg Bacon · Apr 2, 2010

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).

If that's the case, clone without -s.