4

I need to clone an SVN repository as a bare Git repo.

At the moment, I accomplished this by:

  1. Cloning the SVN repo with git-svn:

    $ git svn clone http://svn.code.sf.net/p/syntaxhighlight/code/
    
  2. Moving the .git directory to the wanted place:

    $ mv code/.git /srv/git/syntaxhighlight
    

But I don't find this really handy and I cannot see any reference to bare when I man git svn. Besides, if the SVN repo has been updated, I can run git svn fetch, but I get errors when I try to rebase.

Can any option do the trick?

Ideally, I would like an option similar to git clone --mirror.

Running Git 2.1.4

1 Answers1

2

After moving the .git directory to the wanted place you missed doing the following:

$ rm -rf code    # you might want to get rid of the check-out
$ cd /srv/git/syntaxhighlight
$ git config --bool core.bare true

I found the following Stackoverflow question How to convert a normal Git repository to a bare one? providing the answer to your problem.

To your question about git svn rebase: I can't think of using git rebase on a bare repository. I only use it on a normal git repository. So I think the same applies for git svn rebase.

git svn fetch works in a normal or bare repository because it works without a checkout directory.

Phil
  • 21