4

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?

rainbow
  • 979
  • 2
  • 11
  • 26
  • Does this answer your question? [How do I migrate an SVN repository with history to a new Git repository?](https://stackoverflow.com/questions/79165/how-do-i-migrate-an-svn-repository-with-history-to-a-new-git-repository) – kenorb Jun 22 '20 at 15:15
  • Hard to say without tests. Maybe something changed in the mechanism of import and now branches are local. I don't know. – rainbow Jun 25 '20 at 11:00

3 Answers3

8

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: http://www.sailmaker.co.uk/blog/2013/05/05/migrating-from-svn-to-git-preserving-branches-and-tags-3/

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

rainbow
  • 979
  • 2
  • 11
  • 26
  • Small comment to this. After some time (it has taken me a little to familiarize with Git and side tools) I've noticed that this way of import of tags, creates local tag indeed but also creates a branch. Hovewer further commits are made in master. – rainbow Nov 28 '14 at 06:44
  • When i would like to attach tags or branches with bash script, i have this error : "fatal: Failed to resolved 'remotes/tags/svn/tags/...' as a valid ref" – MychaL Feb 27 '17 at 08:40
  • @rainbow link is broken – w33haa Nov 15 '18 at 21:13
  • @w33haa I regret but I can't do anything with this. This blog wasn't mine. – rainbow Jun 25 '20 at 11:01
1

This is how I got this working (on Mac OSX):

  1. Added credentials to corresponding ~/.subversion/auth file
  2. Tried to run svn log your-repo-url just to see if the svn auth is working
  3. On Mac this would ask me to use my keychain, I selected "Always Allow"
  4. After this my clean-git command would start working as well

There is also ticket logged here but it hasn't been given any attention from the maintainers

Tom
  • 1,360
  • 1
  • 12
  • 30
-1

I had same program. I used this option.

--no-delete

How to this option.

https://bitbucket.org/atlassian/svn-migration-scripts/src

If the --no-delete option is specified, branches and tags will be created but none will be removed.