How to migrate Repo's from one BB cloud to another BB cloud
Asked by Tom Braat:

Hi,

I'm investigating the possiblity to combine two Bitbucket Cloud sites. If my information is correct I can't use the BCMA to migrate BB Cloud to Cloud, what other options do I have? I was not able to clearly find the answer in the community or support pages.

Thanks!


Answers:
author: Theodora Boudale
body: Hi Tom,

When you say two Bitbucket Cloud sites, do you mean workspaces? If so, it is possible to transfer a repository from one workspace to a different one. All commits and metadata (including PRs) get transferred, except for Deployment variables. In case you are using Pipelines and have Deployment variables in any of these repos, please make a note of them so you can recreate them after transfer.

You can read more details on how to transfer a repository here:

* <https://support.atlassian.com/bitbucket-cloud/docs/transfer-repository-ownership/>

If you transfer a repository, its URL is going to change after the transfer request gets accepted. Users who have a clone of repos you are going to transfer on their machine will need to update the remote URL in each clone. Details are provided in the last section of the page I shared.

Please note that repositories with Git LFS cannot be transferred. In case you want to transfer a repo with Git LFS, please check the workaround provided on the following page:

* <https://support.atlassian.com/bitbucket-cloud/docs/current-limitations-for-git-lfs-with-bitbucket/>

I'm afraid that metadata for these repos cannot be transferred.

If you have any questions, please feel free to let me know.

Kind regards,  
Theodora

comments: author: Tom Braat
body: Hi Theodora,

Many thanks for you extensive answer!

Here is my full migration **use case**, and I hope you can give me some advice:

For my client I'm investigating BB migration options.

* 1 department has an operational BB-server, which we would like to migrate to BB-Cloud (using BCMA).
* Another department has already an operational BB-Cloud.

**Approach:**

Ideally I like to combine both to have 1 operational BB-Cloud environment.

My first plan is/was to migrate the BB-server to a clean/empty BB-cloud instance (to not interrupt the existing operational BB-cloud environment). Followed by migrating these repo's in cloud to the existing BB-cloud instance.

Would this be a smart approach, or do you suggest immediatly to migrate the repo's in server to the existing BB-cloud instance?

Thanks a lot!

Kind Regards,

Tom


author: Theodora Boudale
body: Hi Tom,

I would recommend migrating the Bitbucket Server instance to the existing Bitbucket Cloud workspace for the following reasons:

* this will save you the trouble of transferring the Cloud repos from the existing Cloud workspace to a new one
* in case there are any apps installed in the existing workspace (these can be found at <https://bitbucket.org/>\<workspace-id\>/workspace/settings/addon-management), you won't have to reconfigure these in a new workspace if you keep the existing one
* if the existing Cloud workspace has integrations with third-party tools, and you transfer the Cloud repos to a new workspace, you would need to make changes to these integrations as well (so instead of workspace-a-existing they connect to workspace-b-new)

A few more things to note:

**1.** If you decide to migrate the Bitbucket Server instance to the existing Bitbucket Cloud workspace with the BCMA, and there are conflicts with repo or project names, the BCMA will let you know. It will not allow you to proceed with the migration until these conflicts are resolved.

**2.** The BCMA can migrate users from Bitbucket Server to the Bitbucket Cloud workspace, but the ++permissions won't be migrated++ (this is the case if you migrate both to a new Cloud workspace or to the existing one). You will need to set up the permissions after migration.

**3.** I assume that the existing Bitbucket Cloud workspace already has some User groups. Each User group in a Cloud workspace has the setting

**Automatically assign permissions for new repositories**   
**Repositories added to the system will automatically be assigned this permission.**

which can be set to **None** , **Read** , **Write** , or **Admin**.

This can be found if you open the workspace on Bitbucket website, go to its **Settings** \> select **User groups** \> select a certain user group \> select **Edit**.

If certain user groups (from the existing ones) have this setting set to **Read** , **Write** , or **Admin** , then these user groups will automatically gain the respective access to the newly migrated Server repos (once you migrate with the BCMA). If this is not desirable, you can change this setting to **None** for all user groups (except perhaps for Admins?)

You can then create new User groups for the users of department 1 and assign them manually to each migrated repo from **Repository settings** \> **User and group access**.

Be mindful of the setting **Automatically assign permissions for new repositories** when creating a new User group, if you don't want this user group to automatically gain access to any newly created repos in that workspace.

<br />

We also have the following documentations which can help with preparing for the migration:

* <https://support.atlassian.com/migration/docs/plan-your-bitbucket-server-to-cloud-migration/>
* <https://support.atlassian.com/migration/docs/use-the-bitbucket-cloud-migration-assistant-to-migrate/>

And also this one, which can be useful for the admins of the Bitbucket Server instance after the migration:

* <https://support.atlassian.com/migration/docs/differences-administering-bitbucket-data-center-and-cloud/>

If you have any questions, please feel free to reach out!

Kind regards,  
Theodora


author: Tom Braat
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) Thanks again for the advice!

We decided to migrate the BB server to an empty BB Cloud instance, and use it from there. Besides the permissions you indicated above, what else doesn't get migrated with the BCMA or that is it?

I'm trying to get clear what are my post-migration steps after I migrated from BB server to BB Cloud using the BCMA.

Thank you in advance!


author: Theodora Boudale
body: Hi Tom,

Thank you for the update and you are very welcome!

We have the following doc that has a list of post-migration tasks:

* <https://support.atlassian.com/migration/docs/after-migrating-to-bitbucket-cloud/>

Everything from "Review and assign user permissions" to "Install apps" is things that are not migrated.

Default reviewers can be added either to Project settings or to Repository settings.

Webhooks, branch permissions and merge checks can be added to Repository settings.

The only thing not included in the list is LFS content, which is not migrated. In case you had repos with Git LFS, you can check the workaround on [this page](https://support.atlassian.com/bitbucket-cloud/docs/current-limitations-for-git-lfs-with-bitbucket/), specifically, the section "Repositories can not be transferred".

Please feel free to let me know if you have any questions!

Kind regards,  
Theodora


author: Tom Braat
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086),

Thank you, this link is very usefull! One extra question during cloud migration preparation rises:

We have now a Jira Server connected to a Bitbucket Server, in which Bitbucket actions are linked to Jira issues.

We would like to retain these links after the migration of Jira and BB to Cloud. Should I do anything special, should I migrate BB first and then Jira to Cloud or?

Or will all links come back after resolving the connection again: <https://support.atlassian.com/bitbucket-cloud/docs/connect-bitbucket-cloud-to-jira-software-cloud/> ?

Thanks in advance!

Kind Regards,

Tom


author: Theodora Boudale
body: Hi Tom,

Are you referring to Jira issue keys referenced in Bitbucket commit messages, which become links to the respective Jira issues?

If the Jira issue keys remain the same in the Jira Cloud instance, then creating a connection between Bitbucket Cloud and Jira Cloud will make these issue keys links to the respective issues. It doesn't matter if you migrate Jira or Bitbucket first. After you migrate both to Cloud, creating the connection as per the doc you linked should create the links.

Is that what you are referring to? You mentioned, "Bitbucket actions are linked to Jira issues", so I am not sure if you are referring to something else instead.

Kind regards,  
Theodora


author: Tom Braat
body: Hi Theodora,

Yes I'm referring to Jira issue keys referenced in Bitbucket commit messages and their respective links. And besides that also smart commits are used.

After Jira migration to Cloud I guess these issue keys remain the same right?

And is smart commits feature also supported during server to cloud migration?

Thanks!

Kind Regards,

Tom


author: Theodora Boudale
body: Hi Tom,

> After Jira migration to Cloud I guess these issue keys remain the same right?

If you use the [Jira Cloud Migration Assistant](https://marketplace.atlassian.com/apps/1222010/jira-cloud-migration-assistant?tab=overview&hosting=server), then the project keys and in turn the issue keys are going to remain the same.

> And is smart commits feature also supported during server to cloud migration?

I am not sure what you mean by smart commits being supported during migration. Any smart commits that users have already made with Bitbucket Server - Jira Server will have already added comments, time, and transitioned any Jira Server issues.

After you migrate both products to Cloud and integrate them, it will still be possible to use smart commits. The documentation for that is here:

* <https://support.atlassian.com/bitbucket-cloud/docs/use-smart-commits/>

Smart commits will be enabled by default, but you can also disable them:

* <https://support.atlassian.com/bitbucket-cloud/docs/enable-smart-commits/>

Please feel free to let me know if you have any other questions!

Kind regards,  
Theodora


author: Tom Braat
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)

I'm almost ready with the migration preparation phase. I have checked the doc: <https://support.atlassian.com/migration/docs/after-migrating-to-bitbucket-cloud/> and I'm currently preparing for these post-migration steps.

I like to know is there any option/way to get to know if Git LFS and webhooks are used in any repo, without opening each repo setting?

Thanks!

Kind regards,

Tom


author: Theodora Boudale
body: Hi Tom!

Bitbucket Server has the following API endpoint that you can use to find webhooks in a repository:

* <https://developer.atlassian.com/server/bitbucket/rest/v807/api-group-repository/#api-api-latest-projects-projectkey-repos-repositoryslug-webhooks-get>

You can use the API to iterate through all repos in your instance and then use this endpoint to find out which repos have webhooks.

Bitbucket Cloud has an API endpoint for creating webhooks, if you'd like to then create the webhooks in the migrated repos using a script:

* <https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-repositories-workspace-repo-slug-hooks-post>

<br />

Regarding Git LFS, there is an undocumented API endpoint for Bitbucket Server that you can use to find out if Git LFS is enabled for a repo:

* [https://jira.atlassian.com/browse/BSERV-8935?focusedCommentId=1916441\&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1916441](https://jira.atlassian.com/browse/BSERV-8935?focusedCommentId=1916441&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1916441)

Please keep in mind that it is possible for a repo to have this setting enabled but no LFS data committed to it. However, you can use it to narrow down which repos do not have LFS.

For the repositories that do have the LFS setting enabled, you can use the Git command **git lfs ls-files --all** in a clone of each repo, in order to figure out if there are indeed LFS files in each repo. If there are none, the command will return no output, otherwise, it will return all files that are tracked with LFS in that repo.

Kind regards,  
Theodora


author: Tom Braat
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)

Thank you very much for the detailed information! We are going to continue with our preparations.

Kind Regards,

Tom


author: Theodora Boudale
body: You are very welcome Tom, please feel free to reach out if you need anything further!


author: Dave Theodore [Coyote Creek Consulting]
body: If you don't care about the pull request history, you can use the git "--mirror" switch to copy all content from the source repo and push to the destination. Check [Atlassian's Git doc](https://www.atlassian.com/git/tutorials/git-move-repository).

comments: author: Tom Braat
body: Thanks, and what if I do care about the pull request history, what are my options then?


Tags: bitbucket-cloud

cloud

migration