SourceForge: Mirror GIT repository to SVN
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.
- I have local GIT repository with many linked remotes (my own repository, sf.net, github etc).
- I would like to make from my local repository an SVN-aware GIT repository to mirror my development.
- 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.
- Only one branch should be mirrored to SVN. It could be master branch or any other dedicated to mirroring - didn't bother ether.
- SVN would reside on SourceForge.
Is it possible to 开发者_Go百科make this thing really work?
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:
Create Subversion repository:
$ svnadmin create $SVN_REPO
Clone Git repository:
$ git clone --mirror $GIT_REMOTE_REPO $GIT_REPO
Configure SubGit:
$ subgit configure $SVN_REPO
Adjust SubGit configuration file:
# Specify 'git.default.repository = $GIT_REPO' # at $SVN_REPO/conf/subgit.conf
Add authors mapping:
# Add all the authors as # svnauthor = Git Author <git.author@company.com> # into $SVN_REPO/conf/authors.txt
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.
git svn init
or git svn clone
are intended to connect to an existing SVN repo, so I'd suggest the following.
- Set up an empty SVN repo
- Set up a new git repo with
svn git clone
- Pull your local git repo into the new one
- 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.
精彩评论