I use git-svn to maintain backups of our entire SVN repository. It’s fast, secure and easy; and the git clone of the whole repository history, branches and all uses about the same space as a subversion needs for a single revision, single branch checkout. No brainer.
Originally we used svn+ssh:// to provide remote SVN access. But as we’ve begun to collaborate with more and more people, we’ve needed to open up subtrees of our repository. And rather than creating user accounts for all these folk we’ve been giving them https:// access. This means that www-data needs to own the repository, so everyone needs to switch over to the new access scheme.
For regular svn checkouts that’s easy enough:
OLD_URL = `svn info; grep URL; cut -d" " -f2`
svn switch --relocate $OLD_URL $NEW_URL
Unfortunately git-svn has no equivalent sub command. Fear not. You could just clone from the new repository location, but that would be horribly wasteful. The following procedure (mainly cribbed from GitWiki) will see you right:
- Using svn checkout HEAD from the https:// repository. Cache your authentication credentials so git-svn can use them if necessary. This is important.
- If there haven’t been any commits since your last
git-svn rebase
make one now e.g. touch kick; svn add kick; svn commit -m "Kicking git-svn"
. This is important.
- Now, in your git-svn checkout edit .git/config. In the svn section, comment out the old
url
entry (hash or semicolon are valid) and add a new one.
git-svn fetch
to fetch a new revision from the new repository
- In .git/config comment out the new
url
entry and restore the old one.
git-svn rebase -l
to perform a local rebase
- In .git/config comment out the old
url
entry and restore the new one.
- Enjoy the fresh minty taste.