Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RW Access git repository using svn (git-svnserver)?

Is there a program that does what git-svn does, but in a situation where the repository on the server is git, and the developer uses svn?

I know that github.com allows svn access to the git repositories they host, but it doesn't look like they've released this project open source (yet?), and using their servers is not an option for me (not even their private repositories).

EDIT: I think what I am looking for is a parallel to 'git-cvsserver' -- git-svnserver. In a bit of searching, I found some 2-3 year old threads on the git mailing list, but it doesn't look like anyone has made significant progress. I hope someone can correct me on that.

Are there any git-svnserver projects currently underway? I'd hate to have duplicate effort, but it seems that GitHub is the farthest along, but nobody else can have it.

like image 371
Nate Parsons Avatar asked Sep 07 '10 19:09

Nate Parsons


People also ask

Can I use Git for SVN repository?

Use git-svn, it is really simple. First clone your repository with git svn clone then you can git svn dcommit your work or git svn rebase it on the latest changes. Make sure your history is always linear by always rebasing your local branches on master so that you can merge them with git merge --ff-only .

What is SVN repository Git?

git svn is a simple conduit for changesets between Subversion and Git. It provides a bidirectional flow of changes between a Subversion and a Git repository. git svn can track a standard Subversion repository, following the common "trunk/branches/tags" layout, with the --stdlayout option.

What is the difference between Git and SVN?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.


2 Answers

Take a look at SubGit.

SubGit is server-side solution, it enables Subversion access to Git repository and vice versa. You may refer to documenation for more details, but in general it is fairly easy to use SubGit:

SubGit needs local access to Git repository you're pushing to. Create Subversion repository on the same machine:

    $ svnadmin create $SVN_REPOS

then run

    $ subgit configure $SVN_REPOS

This command creates $SVN_REPOS/conf/subgit.conf file, adjust its git.default.repository option just as follows:

    [git "default"]
    repository = /path/to/your/git/repository.git

You can specify many Git repositories synced to single Subversion repository, just add necessary [git "identifier"] sections.

You can also specify arbitrary repository layout, e.g. the standard one looks like this:

    trunk = trunk:refs/heads/master
    branches = branches/*:refs/heads/*
    shelves = shelves/*:refs/shelves/*
    tags = tags/*:refs/tags/*

You can also adjust $SVN_REPOS/conf/authors.txt to map svn author names to git identities.

After that run:

    $ subgit install $SVN_REPOS
    $ ... let initial translation complete ... 
    $ TRANSLATION SUCCESSFUL

At this moment you have Subversion repository and its Git counterpart which are continuously synchronized, i.e. SubGit immediately translates svn revision into git commit on every svn commit and git commit into svn revision on every git push.

So, you can commit changes to created Subversion repository and keep all changes in sync with the main Git repository.

like image 88
vadishev Avatar answered Oct 10 '22 00:10

vadishev


This is Python code to serve a git repository over svn protocol:

http://git.q42.co.uk/git_svn_server.git

like image 31
mab Avatar answered Oct 10 '22 00:10

mab