How to migrate from bitbucket to stash

We are currently using BitBucket and want to move our repositories to Stash.

3 answers

1 accepted

It documented on Atlassian Docs:

It is significat to make Bare clone, not simple Copy clone. Because if you make not a Bare mirror, you get no remote branches. And push --all will not work fine.

I used follow commands to completelly migrate from one Git to another, this will copy anything:

git clone --bare
cd myrepo.git
git push --mirror
cd ..
rm -rf myrepo.git

In this solution you no need to add remote.

Thanks Alexey. You're quite right - that's actually a better way to do it.

Wouldn't it be better to mirror the clone at the first step?

git clone --mirror

Also, is the process repeatable if commits are made to the Bitbucket repo?

Hi David,

I guess this depends on how many repositories you have to migrate? If we're talking 5-10, then frankly I would just do it manually for now.

If you have more thant that it might be worth thinking about writing a script (which we could definitely help with). You could use both the REST endpoints to query the Bitbucket repositories and re-create them in Stash.



Not specifically. It's really just the normal Stash documentation you might want to take a look at:

For each repository in Bitbucket you will want to clone the repository to a machine, create a matching repository in Stash and then push all the branches/tags. Something like:

git clone
cd repo-name
git remote add stash ssh://git@server:7999/PROJECT/repo-name.git git push --all stash && git push --tags stash

You may then also want/need to setup user permissions on your projects as appropriate to your organization.

I hope this helps?


Hi Charles,

Is there some documentation somewhere on how to do this manually?



Thanks for everyone's help - I'll get started with the migration today.

Dave Kunkel

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

156 views 3 7
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot