I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like:
SVN repository in: <
subgit import --svn-url url://svn.serv/Bla/Bla directory/path/Local.git.Repo
It's all.
+ To update from SVN, a Git repository created by the first command.
subgit import directory/path/Local.git.Repo
I used a way to migrate to Git instantly for a huge repository.
Of course you need some preparation.
But you may don't stop development process, at all.
Here is my way.
My solution looks like:
Migration takes a lot of time for a big SVN repository.
But updating of the completed migration just seconds.
Of course I'm using SubGit, mama. git-svn makes me Blue Screen of Death. Just constantly. And git-svn is boring me with Git's "filename too long" fatal error.
STEPS
1. Download SubGit
2. Prepare migrate and updating commands.
Let's say we do it for Windows (it's trivial to port to Linux).
In a SubGit's installation bin directory (subgit-2.X.X\bin), create two .bat files.
Content of a file/command for the migration:
start subgit import --svn-url url://svn.serv/Bla/Bla directory/path/Local.git.Repo
The "start" command is optional here (Windows). It'll allow to see errors on start and left a shell opened after completion of the SubGit.
You may add here additional parameters similar to git-svn.
I'm using only --default-domain myCompanyDomain.com to fix the domain of the email address of SVN authors.
I have the standard SVN repository's structure (trunk/branches/tags) and we didn't have troubles with "authors mapping". So I'm doing nothing any more.
(If you want to migrate tags like branches or your SVN have multiple branches/tags folders you may consider to use the more verbose SubGit approach)
Tip 1: Use --minimal-revision YourSvnRevNumber to see fast how things boils out (some kind of a debugging).
Especially useful is to see resolved author names or emails.
Or to limit the migration history depth.
Tip 2: Migration may be interrupted (Ctrl + C) and restored by running of the next updating command/file.
I don't advise doing this for big repositories. I have received "Out of memory Java+Windows exception".
Tip 3: Better to create a copy of your result bare repository.
Content of a file/command for updating:
start subgit import directory/path/Local.git.Repo
You may run it any amount of times when you want to obtain the last team's commits to your Git repository.
Warning! Don't touch your bare repository (creation of branches for example).
You'll take the next fatal error:
Unrecoverable error: are out of sync and cannot be synced ... Translating Subversion revisions to Git commits...
3. Run the first command/file. It'll take a loooong time for a big repository. 30 hours for my humble repository.
It's all.
You may update your Git repository from SVN at any time any amount of times by running the second file/command. And before switching of your development team to Git.
It'll take just seconds.
There's one more useful task.
Push your local Git repository to a remote Git repository
Is it your case? Let's proceed.
Run:
$ git remote add origin url://your/repo.git
By default your Git can't send big chunks. fatal: The remote end hung up unexpectedly
Let's run for it:
git config --global http.postBuffer 1073741824
524288000 - 500 MB 1073741824 - 1 GB, etc.
Fix your local certificate troubles. If your git-server uses a broken certificate.
I have disabled certificates.
Also your Git server may have a request amount limitations needing to be corrected.
Run with a local Git:
git push origin --mirror
(git push origin '*:*' for old Git versions)
If you get the following: error: cannot spawn git: No such file or directory... For me the full recreation of my repository solves this error (30 hours). You can try the next commands
git push origin --all
git push origin --tags
Or try to reinstall Git (useless for me). Or you may create branches from all you tags and push them. Or, or, or...