SourceForge: Mirror GIT repository to SVN

1.1k views Asked by At

I have a project developing using GIT. I need to make a SVN mirror only repository for users that didn't like GIT. I googled some instructions about it but all of them failed. Part of them written for Linux - I have Windows. Part of them suggest to create empty repository and then syncing it with main GIT repository - it's not really what I want. Part of them simple didn't work failing on different stages with cryptic messages. So I decided to ask here. I digged into git-svn command description in desperate attempt to make this thing work by myself. I'm failed too. Github svn export too unstable to rely on it. Now I'm asking you to help.

So, here the task.

  1. I have local GIT repository with many linked remotes (my own repository, sf.net, github etc).
  2. I would like to make from my local repository an SVN-aware GIT repository to mirror my development.
  3. SVN repository would be a read-only mirror. It would be nice if SVN retain history of changes but if it's impossible - I didn't bother.
  4. Only one branch should be mirrored to SVN. It could be master branch or any other dedicated to mirroring - didn't bother ether.
  5. SVN would reside on SourceForge.

Is it possible to make this thing really work?

2

There are 2 answers

0
bjhend On

git svn init or git svn clone are intended to connect to an existing SVN repo, so I'd suggest the following.

  1. Set up an empty SVN repo
  2. Set up a new git repo with svn git clone
  3. Pull your local git repo into the new one
  4. Do a git svn dcommit of the branch you want to share with the SVN repo

Another completely different approach is to use git and SVN on the same work files. You only have to make sure to ignore the .git and .svn dirs respectively. Then you use git commands for git and SVN commands for SVN.

Of course, with this approach you have to sync every commit manually you want to have in both repos, but if you don't care to have all commits in both repos this might be sufficient.

0
vadishev On

I think SubGit is the way to go.

The problem is that SubGit installs its own hooks right into Subversion and Git repositories. So, I doubt it's possible to setup that for hosting provider, like sourceforge or google code.

If you create your own Subversion repository, it's not a big deal to setup even read-write mirror with SubGit:

  1. Create Subversion repository:

    $ svnadmin create $SVN_REPO
    
  2. Clone Git repository:

    $ git clone --mirror $GIT_REMOTE_REPO $GIT_REPO
    
  3. Configure SubGit:

    $ subgit configure $SVN_REPO
    
  4. Adjust SubGit configuration file:

    # Specify 'git.default.repository = $GIT_REPO'
    #     at $SVN_REPO/conf/subgit.conf
    
  5. Add authors mapping:

    # Add all the authors as
    # svnauthor = Git Author <[email protected]>
    #     into $SVN_REPO/conf/authors.txt
    
  6. Install SubGit into Subversion repository:

    subgit install $SVN_REPO
    

After installation is finished, you can clone $GIT_REPO as another remote and push to this repository to get all the commits converted into Subversion repository.

One may commit changes into Subversion repository, SubGit converts them automatically into Git commits, so you may fetch them back.

SubGit is a commercial project but it's free for open-source projects. For more details please refer to SubGit documenation and git-svn comparison.