Search code examples
gitsvnclone

SVN to Git using svn-migration-scripts


Clone of SVN repo to Git repo works fine.
However i have problem with

java -Dfile.encoding=utf-8 -jar c:\svn-migration-scripts.jar clean-git --force

Command listed above should convert all remotes tags into local ones.
But i recieve:

# Creating annotated tags...
tag has diverged: 1.0_RC1
Creating annotated tag '1.0_RC1' at refs/remotes/tags/1.0_RC1.
# Creating local branches...
# Checking for obsolete tags...
svn: E215004: Authentication failed and interactive prompting is disabled; see t
he --force-interactive option
svn: E215004: Unable to connect to a repository at URL 'http://127.0.0.1/svn/dri
veLearner/tags'
svn: E215004: No more credentials or we tried too many times.
Authentication failed
Deleting Git tag '1.0_RC1' not in Subversion.
Deleted tag '1.0_RC1' (was d200bf6)
# Checking for obsolete branches...
svn: E215004: Authentication failed and interactive prompting is disabled; see t
he --force-interactive option
svn: E215004: Unable to connect to a repository at URL 'http://127.0.0.1/svn/dri
veLearner/branches'
svn: E215004: No more credentials or we tried too many times.
Authentication failed
No obsolete branches to remove.
# Cleaning tag names
# Cleaning branch names

I use local winXP, java 1.7_65, VisualSVN Server(http, port 80). Repo is available for Everyone in read/write mode.
Funny thing is i've done this process but on other repo succesfully after the same problems, but i don't know what i've done.
Have somebody some solution?


Solution

  • This svn-migration-script.java from Atlassian is a crap. Here is detailed instruction how to migrate from SVN to Git with minimum of third party soft and with preserve local branches and tags.

    DETAILED TUTORIAL:
    [this original link is dead] http://www.sailmaker.co.uk/blog/2013/05/05/migrating-from-svn-to-git-preserving-branches-and-tags-3/
    [possible replacement] https://blog.redbranch.net/2015/06/12/migrating-from-svn-to-git-with-branches-and-tags/

    SVN server:
    url: [svn_address]/[project_name]/[project_name]
    user: [user]
    pass: [pass]
    (access for user [user]: rw)

    target:
    c:[eclipse_workspace][project_name] (create directories if don't exist)

    Procedure:
    ++ install svn and git (with Git Bash) in your system (optionally add their 'bin' directories to PATH)
    ++ make sure svn serwer works in http mode (not in https)
    ++ make authors.txt if necessary
    ++ clone svn to git: git svn clone --stdlayout --authors-file=c:\authors.txt
    [svn_address]/[project_name] c:[eclipse_workspace][project_name] [user] [pass]
    command rebase -b 0x64000000 "c:\program files\git\bin\libsvn_repos-1-0.dll" (or analogical) can be useful if some error with mapping will appear
    ++ run Git Bash from context menu (you should have installed this)
    ++ type git branch -a to check your branches and tags
    ++ type in Git Bash:

    to attach branches:

    for branch in `git branch -r | grep "branches/" | sed 's/ branches\///'`; do
      git branch $branch remotes/branches/$branch
    done
    

    to attach tags:

    for tag in `git branch -r | grep "tags/" | sed 's/ tags\///'`; do
     git tag $tag remotes/tags/$tag
    done
    

    ++ create bare git repository and push there [project] (you will loose SVN dependencies)
    ++ clone [project] to target location