Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Having troubles migrating svn to stash at the svn-migration-scripts.jar sync-rebase step

Deleted user June 2, 2014

Hi there. I've been able to complete every step of the migration up until the sync-rebase step from this guide:

https://www.atlassian.com/git/migration#!migration-synchronize

The repo will eventually end up in a Stash repo, but I'm using a local repository for the transition period.

I was able to perform a successful "git svn fetch" to see commits coming in from the old SVN repo. However, I receive the following error when I try these commands:

  • java -Dfile.encoding=utf-8 -jar ../svn-migration-scripts.jar sync-rebase
  • java -Dfile.encoding=utf-8 -jar ../svn-migration-scripts.jar sync-rebase --prefix=origin/

Note that I tried out the second command because of this thread. I had received the same warning from git-svn about needing to default the prefix to origin/

Both of those commands resulted in this error:

fatal: ambiguous argument 'remotes/trunk': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Error finding tracking ref for branch master

---------------------------------

Some other info:

  • I'm currently on the master branch
  • here are a few branches listed in 'git branch -r'

origin/tags/ap-2.0.9
origin/trunk

2 answers

1 accepted

3 votes
Answer accepted
jgauthier June 4, 2014

Hi Matthew, I have had the same problem but could not find a direct fix.

What I decided is to manually proceed with a merge: merge my origin/trunk (svn/trunk in my case) with the master. Then I could see the latest update received from "git svn fetch"

Hope this can help :)

Jerome

Deleted user June 11, 2014

Thanks for the help Jérôme. I ended up having to do most of the migrations manually myself. Once I performed the steps above, doing a rebase on git repository synced things up nicely.

Ramon Padilla October 15, 2015

Hi, I've just encountered the same problem and I'm a git newbie. Could you explain what you mean by doing the migrations manually?

jgauthier October 15, 2015

Hey, unfortunately it's something I did only once and quite a long time ago, so I don't really remember, sorry. Jerome

Ramon Padilla October 16, 2015

OK, I'll ask the question again and see if anyone comes up with a solution. Thanks.

6 votes
Support jobs.ch July 22, 2014

Workaround for this issue, just use an empty prefix while cloning:

git svn clone --prefix='' --stdlayout --authors-file=...

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 23, 2014

Not that it helps, but there is a public issue tracking this:

https://bitbucket.org/atlassian/svn-migration-scripts/issue/2/git-20-incompatability

Jörgen Persson October 21, 2015

I had the same problem, but using --prefix='' solved the problem. Would be nice if the documentation (https://www.atlassian.com/git/tutorials/migrating-convert) is updated. Using the following: svn-migration-scripts: using version 0.1.56bbc7f Git: using version 2.6.2 Subversion: using version 1.8.8 git-svn: using version 2.6.2

Like Dave Zygadlo likes this
Matt Holbrook-Bull July 13, 2016

is there any way at all to fix this post-clone? it took so long for our clone to complete Im not sure I have the time to run it again.

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 13, 2016

@Matt Holbrook-Bull It's been a while since I've used git-svn, and as such please take everything here with a grain of salt.

In theory you should just be able to rename the branch/tags locally to the expected format and it should work. So for example changing "refs/remotes/origin/tags/*" to "refs/remotes/tags/*". Before doing any manual changes on your repository I would first suggest taking a full backup of the clone (especially the .git folder) so that you don't have re-do the clone.

Changing the refs themselves should just require moving the .git/refs/remotes/origin contents up a directory. You'll also need to edit the .git/config file to something like this, where you no longer see 'origin/' in the fetch/branches/tags configuration.

[svn-remote "svn"] 
        url = https://svn.company.com/repos/
        fetch = project-foo/trunk:refs/remotes/trunk 
        branches = project-foo/branches/*:refs/remotes/* 
        tags = project-foo/tags/*:refs/remotes/tags/*
Like # people like this
Yoganand Bijapur October 26, 2016

after doing above steps edit .git/packed-refs file and delete "origin/". Then run "git svn fetch".

Then execute

java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar sync-rebase
Like # people like this
Tsvetomir Matov February 20, 2018

Thanks you Charles & Yoganand for the solution! It saved me many hours for new migration. 

Dave Zygadlo April 15, 2020

Updating my script to include --prefix='' has fixed my problem.

Atlassian really needs to update the documentation to reflect this!!

Nilay Karcaaltincaba November 3, 2020

Thanks Charles & Yoganand for the solution,vyou saved me from 4 days cloning too,and Atlassian should update the git migration documents it simply causes too much trouble and time loss..

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events