Pushing a converted svn repository to GIT/Stash

Hi,

I ran the following command "git svn clone --stdlayout https://denpwsvn1/svn/magnetar magnetar" to convert one of my Subversion repositories to GIT. Now I want to add that to a new bare repository I added in Stash called magnetar that is located at "http://amorin@dentwgit1:7990/scm/MAG/magnetar.git". I am having trouble here and not sure how to do this. I tried cd'ing into the converted repo and running...

git remote add magnetar http://amorin@dentwgit1:7990/scm/MAG/magnetar.git

then

git push --all magnetar

I get propmted for my password and the recieve the following message.

Password for 'http://amorin@dentwgit1:7990':
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date

Any idea on what I am missing. Sorry very new to GIT.

Thanks

Andrew

3 answers

1 accepted

Hello Andrew,

Have a look at SVN Importer Plugin for Stash, https://marketplace.atlassian.com/plugins/org.tmatesoft.subgit.stash-svn-importer

With this plugin, you can import any SVN repository into Git right from the Stash UI:

  1. Create empty Git repository;
  2. Go to Settings tab, choose 'Import from SVN' ;
  3. Specify URL to SVN repository;
  4. Specify all the branches and tags in SVN repository;
  5. Optionally specify credentials to authorize against SVN server;
  6. Click import button;

The plugin imports revisions from SVN to Git in the background. You can pause and resume the importing process at any time.

The plugin is Free; it's based on SubGit tool. For more details please refer to http://subgit.com/stash/ or contact us at support@subgit.com

Very nice tool. Thanks for the information.

I also followed the "My code is already tracked by GIT" instructions in Stash using...


C:\Subversion\magnetar\magnetar>git remote set-url origin http://amorin@dentwgit1:7990/scm/MAG/magnetar.git

C:\Subversion\magnetar\magnetar>git
push origin master
Password for 'http://amorin@dentwgit1:7990':
error: src refspec master does not match any.
error: failed to push some refs to 'http://amorin@dentwgit1:7990/scm/MAG/magnetar.git'

and got the message above...

0 vote

Hi Andrew,

error: src refspec master does not match any.

means you don't have a local branch called master.

Just to double check, does the initial Subversion repository you cloned follow the standard Subversion layout and includes trunk, tags and branches subdirectories under https://denpwsvn1/svn/magnetar?

I'm assuiming it does as you've cloned the repository with the --stdlayout flag.

git push --all tries to push all the locla branches in the git repository but

after running the `git svn clone` command, you need to convert all the

Subversion branches to local branches first before you can push them.

The process briefly works like this:

* You do an initial clone (using `git svn clone`)

* You turn the Subversion branches into _local_ git branches

* You turn the Subversion tags (that are just tracked as git branches initially) into git tags

* Now you can push.

If you follow the steps on http://go-dvcs.atlassian.com/display/aod/Clean+Up,

you should be able to push your repository to Stash.

We have a more detailed description about the migration process here (this is talking about moving to Bitbucket but the initial steps apply to Stash as well):

http://go-dvcs.atlassian.com/display/aod/Migrating+from+Subversion+to+Git+on+Bitbucket

and I've written a post about moving the Confluence team on our blog, explaining the process:

http://blogs.atlassian.com/2012/01/moving-confluence-from-subversion-to-git/

Hope this helps.

Cheers,

Stefan

Yes I use the stdlayout for that repository. Thanks..I was just reading about that. Thanks for pointing me in the right direction!

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,768 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you