I searched related questions but I couldn't find anything matching my specific situation: I have some old repository archives from an SVN server that was taken down years ago. They're tarballs of the original repository structure on the server. What I want to do is convert them to git repositories as a basis for future work/reviving the projects. I've already read several tutorials about the conversion process, and I think I can figure out the authors conversion, branches mapping, etc., but they all assume you have an SVN server and a url for the repository. Do I need to install and setup and SVN server to do this conversion, or is there some way I can point either git clone
or svn2git
(or another tool) at the repo dump I have?

- 208,859
- 35
- 376
- 711
-
1Standard edition of VisualSVN Server is free, so there's plan B. – Dialecticus Apr 14 '13 at 22:47
-
I think installing the original SVN server would be a good bit easier than that.. – R.. GitHub STOP HELPING ICE Apr 14 '13 at 22:50
5 Answers
install subversion locally in order to import your dump, then with git-svn package.
You can use git svn clone file:///path/to/svn/repo /path/to/empty/dir

- 6,732
- 3
- 36
- 49
-
1I already found this experimenting last night and got it working, but this is the correct answer. Thanks and +1/accepted! And welcome to SO. :-) – R.. GitHub STOP HELPING ICE Apr 15 '13 at 16:11
Retrieve a list of all Subversion committers:
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
Clone the Subversion repository using git-svn:
git svn clone [SVN repo URL] --no-metadata -A authors-transform.txt --stdlayout ~/temp
Convert svn:ignore properties to .gitignore:
cd ~/temp
git svn show-ignore > .gitignore
git add .gitignore
git commit -m 'Convert svn:ignore properties to .gitignore.'
Push repository to a bare git repository:
git init --bare ~/new-bare.git
cd ~/new-bare.git
git symbolic-ref HEAD refs/heads/trunk
Then push the temp repository to the new bare repository.
cd ~/temp
git remote add bare ~/new-bare.git
git config remote.bare.push 'refs/remotes/*:refs/heads/*'
git push bare
Rename “trunk” branch to “master”:
cd ~/new-bare.git
git branch -m trunk master
Clean up branches and tags:
cd ~/new-bare.git
git for-each-ref --format='%(refname)' refs/heads/tags |
cut -d / -f 4 |
while read ref
do
git tag "$ref" "refs/heads/tags/$ref";
git branch -D "tags/$ref";
done
Reference: http://john.albin.net/git/convert-subversion-to-git

- 13,014
- 20
- 92
- 137
-
Also see [How to git-svn clone the last n revisions from a Subversion repository?](https://stackoverflow.com/questions/747075/how-to-git-svn-clone-the-last-n-revisions-from-a-subversion-repository) which describes how to selectively clone svn to git. – Richard Chambers Dec 15 '20 at 01:20
- All (?) svn -> git converters require live Subversion repository,
- Tree-copy of repository is not a dump, it's usual file-level backup.
You have:
- Install and configure any Subversion server (if your converter can't handle
file:///
protocol for SVN, otherwise it's not needed - just unpack tarball(s) and check repo with svn client) - Read about git-svn
- Use git-svn

- 29,961
- 12
- 103
- 150

- 94,711
- 9
- 78
- 110
Take the dump file in your severs:
svnadmin dump "repopath or url" > import.bkp git svn clone "back"
Go to the clone path and then open git bash and run these commands:
git svn show-ignore > .gitignore git add .gitignore git commit -m "with message" git check in "git url"

- 22,977
- 20
- 73
- 80
-
1Can you elaborate what `git svn clone "back"` does? I'm not understanding how svnadmin dump and this command relate to one another? Are you just taking a backup of the svn repository prior to using git svn clone, in case you screw something up? – John Zabroski Mar 02 '20 at 17:41
The reposurgeon
tool supports direct (and extremely fast) conversion of SVN dump files to Git repositories.

- 7,746
- 2
- 25
- 38