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

Migrating from Stash to Bitbucket

robert-bartlett
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 3, 2014

We are looking at migrating several Stash respositories into Bitbucket. These repositories have accumulated a healthy number of pull request comments that we would like to bring along as a part of the migration.

Is this possible (and how)?

5 answers

1 accepted

2 votes
Answer accepted
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.
February 4, 2014

Hi Robert,

I'm afraid not. Obviously importing the Git repositories is easy enough, but we don't have any tooling around migrating the pull request data.

Your best and only bet at the moment would be to use the various REST APIs of both products to recreate the data in some form.

https://confluence.atlassian.com/display/BITBUCKET/pullrequests+Resource

https://developer.atlassian.com/static/rest/stash/latest/stash-rest.html#idm1341440

I'm not going to lie - that could be quite tricky. Some things that come to mind:

1. Recreating the original user - we don't have a sudo REST endpoint. If that is important I might suggest writing a simple plugin with an http filter that lets you impersonate a given user.

2. To create a pull request for a branch that has already been merged you would probably have to create 2 temporary branches in Stash on the commits prior to the PR merge. You could then attach the relevant comments, and then either move the source branch to the target branch which will then mark the PR as merged, or just decline it.

Let me know if you have any specific questions, but otherwise I'm afraid in the short term there isn't much else you can do.

Charles

3 votes
Henning Klokkeråsen March 18, 2015

Hi,

My team is in the same scenario.

Has anything been done since this question was answered, or will migrating Stash to BitBucket imply we lose pull request history?

1 vote
Maren
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 25, 2019

Hi there,

As you've found, we currently only support migrating repository data (your source code) from Bitbucket Server (formerly Stash) to Bitbucket Cloud. There's no supported method for migrating user accounts, permission structures, or repository metadata like pull request history and comments. We're currently gathering interesting in this feature, so if this is something you need we recommend watching or voting for this issue.

For more information about migrating from Bitbucket Server to cloud, I recommend reviewing Plan your Bitbucket Server to cloud migration

As outlined in the guide, there are a few ways to move your data to the cloud:

  1. Use our repository importer to import individual repositories. To migrate using the importer, your Bitbucket Server domain needs to be publicly accessible. If it's not publicly accessible Bitbucket Cloud will not be able to access to your Bitbucket Server to perform the import.
  2. You can also create a new repository on Bitbucket Cloud, and then simply push from your local repository to the new repository in Bitbucket Cloud.
  3. If you have a lot of repositories, Bitbucket Cloud provides APIs for you to script the creation and pushing of repositories in bulk.

For more info to help you decide if moving from server to cloud is a good option for you, check out our Atlassian Cloud Migration Center

I hope this helps, and please don't hesitate to reach out with questions!

Bill Bohn December 3, 2019

What options do we have then?  Can we upgrade our Stash server to latest version of Bitbucket?  Would that work?  We would like to create a new Bitbucket server and then import all the information into it and the new database.

 

That is the plan we have with Jira, Confluence & Crowd

0 votes
Suresh Sakhare
Contributor
August 24, 2018

Hi,

I am trying to create pull request and attach the relevant comments but, it creates the PR with all commits associated with branch.

URL: https://api.bitbucket.org/2.0/repositories/suresh2702/test/pullrequests

{  
   "title":"Testing pull request created fourth time. with single commit ",
   "close_source_branch":true,
   "destination":{  
      "repository":{  
         "type":"repository",
         "name":"test"
      },
      "branch":{  
         "name":"master"
      }
   },
   "state":"OPEN",
   "source":{  
      "repository":{  
         "type":"repository",
         "name":"test"
      },
      "branch":{  
         "name":"BXI-01"
      },
      "commit":{  
         "hash":"e95bc71987c76503657d273aa7afc6209c4014e8"
      }
   },
   "reviewers":[  
      {  
         "username":"xyz"
      }
   ]
}

 

 Where I am wrong?

0 votes
Santoshi Makarla July 14, 2016

Hi,

   I am trying Move the Repositories from Stash to Bitbucket .Is it is possible ?Can anyone suggest me how can i do that.

 

Thanks,

Makarla

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events