Stim
Stim

Reputation: 1465

How can I duplicate a git-svn cloned repository, so that git svn dcommit still works

I have a rather large svn centralized repository we use with my team. Now I want to use git(-svn) locally, so I made a git-svn clone. This worked fine, but the git-svn clone took a very long time to complete. In contrast, a git clone usually doesn't take that long.

How can a colleague duplicate my svn clone so that he doesn't need to checkout and transform the entire svn history again? I.e. without interaction with svn.

Of course we want the colleague to be able to perform fetch and dcommit to the central svn repository, using his own credentials.

Thnx.

Upvotes: 3

Views: 151

Answers (3)

idbrii
idbrii

Reputation: 11916

Your colleague can fetch your git repo into a git svn init'd one and then git update-ref to have your full history but commit to svn. See my answer on Is there a way to "git svn dcommit" from a cloned git-svn repository for specifics on how to set that up. You'll need the parameters you used to setup your git-svn repo so they can use the same ones to init theirs.

I believe they'll also need to switch the svn-remote url to use their username. See How to clone svn repo with git svn and be able to commit to both git and svn?.

Upvotes: 0

Stim
Stim

Reputation: 1465

Based on the comments added to the question and other answers:

It is possible to just (physically) copy the git repository (or tar/zip copy, or as the docs say rsync).

I tested this solution and, indeed, on the other machine the connection with svn is performed using the svn credentials of that machine, while the entire history is just copied in a few seconds.

Upvotes: 1

Petr
Petr

Reputation: 63359

In short, this procedure is very fragile and not recommended. See git svn man page, section Caveats:

For the sake of simplicity and interoperating with Subversion, it is recommended that all git svn users clone, fetch and dcommit directly from the SVN server, and avoid all git clone/pull/merge/push operations between git repositories and branches. The recommended method of exchanging code between git branches and users is git format-patch and git am, or just 'dcommit’ing to the SVN repository.

So everybody who wants to use git svn should clone his/her own copy from the SVN server.

Another solution is to use SubGit, which will provide you with a git bridge to the repository that you can use interchangeably with SVN:

SubGit is tool for a smooth, stress-free Svn to Git migration. Install it once on the server side and use both Subversion and Git as long as you like.

SubGit operation overview

SubGit lets one to set up a bidirectional Subversion to Git replication (writable mirror). Visit documentation page to get more information.

Upvotes: 5

Related Questions