# Best practices for maintaining a subversion mirror?

2 messages from 2008-11-24 to 2008-11-24. Participants: Oliver Charles, Peter Harris.
Thread: https://gitlist.dev/t/16439

## Oliver Charles, 2008-11-24 10:55

Subject: Best practices for maintaining a subversion mirror?
Message-ID: <5641883d0811240255i21aef729ld202bd5a3211dad9@mail.gmail.com>
URL: https://gitlist.dev/e/5641883d0811240255i21aef729ld202bd5a3211dad9%40mail.gmail.com

```
Hi,

I just got myself a new server, and as I'm the major Git-using person
at my work, I'd like to set a mirror of our Subversion repository up
to hopefully convert a few more people. At the moment, I've done git
svn clone http://svn..., and then git clone --bare to make a --bare
version of this clone.

Now that I have this mirror, I have this entry in my crontab to update
it hourly:

0 * * * * cd /.git && /usr/bin/git --git-dir=. svn fetch &&
/usr/bin/git update-ref refs/heads/master refs/remotes/git-svn

This seems to be working nicely as a readonly interface, but when I
clone this repository (git clone git://foo/repo.git) - served via
git-daemon - I can't seem to get svn rebase to work on it, which means
I can't dcommit my changes back to Subversion.

Am I doing things generally the right way, or am I doing it completely
wrong? :-) Any tips appreciated!

- Oliver Charles

```

## Peter Harris, 2008-11-24 15:37

Subject: Re: Best practices for maintaining a subversion mirror?
Message-ID: <eaa105840811240737t37578c8dp77adf5da27ac7e45@mail.gmail.com>
URL: https://gitlist.dev/e/eaa105840811240737t37578c8dp77adf5da27ac7e45%40mail.gmail.com
In-Reply-To: <5641883d0811240255i21aef729ld202bd5a3211dad9@mail.gmail.com>

```
On Mon, Nov 24, 2008 at 5:55 AM, Oliver Charles wrote:
> This seems to be working nicely as a readonly interface, but when I
> clone this repository (git clone git://foo/repo.git) - served via
> git-daemon - I can't seem to get svn rebase to work on it, which means
> I can't dcommit my changes back to Subversion.
>
> Am I doing things generally the right way, or am I doing it completely
> wrong? :-) Any tips appreciated!

First, make sure you aren't using the --no-metadata flag. git svn
rebase needs that metadata to rebuild its index.

Second, a simple "git clone" will not set up the svn remotes; you have
to do that by hand. This is what I do when I clone my svn mirror:

mkdir project
cd project
git init
git remote add origin git://mirror/project
git config --add remote.origin.fetch +refs/remotes/*:refs/remotes/*
git fetch
git svn init -Ttrunk svn://upstream/project
git config --add svn-remote.svn.fetch branches/foo:refs/remotes/foo
git config --add svn-remote.svn.fetch branches/bar:refs/remotes/bar
git reset --hard trunk
git svn rebase

Once you have it nailed down, you can put it into a script so all your
co-workers don't have to do that by hand too.

(Also, I quickly reset my cron job to run every five minutes; I found
an hour was way too long for my taste. YMMV, of course)

Peter Harris

```
