How to duplicate a Bitbucket Cloud repository

robotsnoindex


 

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

   

Summary

This guide provides step-by-step instructions for duplicating a Bitbucket repository to ensure complete independence from the original repository. Unlike forking, this method severs all connections with the source repository, allowing you to create a standalone copy while retaining complete control over the duplicated repository.

Duplicating a repository will only transfer the existing git data to a new one. All other metadata, such as repository settings, pull requests, pipelines builds, and others, will not be carried over.

Environment

  • Bitbucket Cloud

Solution

There are two methods for accomplishing this:

Option 1 - Import repository via the UI importer

The prerequisites for this option are the workspace location ID, repository URL for duplication, and App password. Please follow the steps below:

  1. Log in to Bitbucket and navigate to the workspace where you want to duplicate the repository.
  2. Click on Create > Repository.
  3. In the top right corner of the form, choose Import repository, or access it directly using this URL: https://bitbucket.org/<WorkspaceID>/workspace/repository/import (Replace <WorkspaceID> with your destination workspace name).
  4. Complete the import form with the following details:
    1. The repository URL you intend to duplicate
    2. Your Bitbucket username
    3. Your App Password
    4. The workspace destination for duplicating the repository
    5. Choose the project
    6. The name for the duplicated repository

      5. Once all information is filled in, click the Import repository button to duplicate the repository.


Option 2 - Clone and Push via CLI

The prerequisites for this option are the workspace ID, repository URL for duplication, and the new repository URL. Please follow the following steps:

  1. Clone the bare repository you want to duplicate locally:
    1. Using HTTPS: 

      git clone --mirror https://<username>@bitbucket.org/<WorkspaceID>/<RepoName>.git
    2. Using SSH: 

      git clone --mirror git@bitbucket.org:<WorkspaceID>/<RepoName>.git
  2. Create the duplicate repository placeholder in your destination workspace and save the URL.
  3. Navigate to the cloned bare repository on your local machine via CLI.
  4. Perform a mirror push to the new repository in the destination workspace:

    1. Using HTTPS :

      git push --mirror https://<username>@bitbucket.org/<WorkspaceID>/<RepoName>.git
    2. Using SSH: 

      git push --mirror git@bitbucket.org:<WorkspaceID>/<RepoName>.git

Remember to change the <username> for your Bitbucket username as well as the <WorkspaceID> and <RepoName>. Change the <WorkspaceID> to the new workspace name if the location is not within the same workspace.

If you encounter issues when following the instructions in this article, please raise a support ticket or raise a community support ticket for further assistance with this.

DescriptionHow to duplicate a Bitbucket repository
ProductBitbucket Cloud
Last modified on Mar 7, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.