Transfer repository ownership

If you have administrative rights to a repository, you can change or transfer the ownership of a repository to another workspace or to an individual account. To complete the transfer, the new account holder must accept the repository. The transferred repository also comes with its commit history, issue tracker, and wiki.

When your transfer is accepted, Bitbucket Cloud automatically updates the repository URL on Bitbucket with the new owner's account name.

Because the repository URL changes on Bitbucket, you (and everyone who accesses it locally) need to change the URL locally so that it can reference the new URL. Alternatively, you can re-clone the repository.

The transferred repository loses all access groups and doesn't inherit the destination account's default access groups. You'll have to set those on the repository after the transfer.

Transfer a repository

Make sure you know which user you want to transfer the repository to before you begin.

  1. From the repository you want to transfer, click Repository settings in the left menu.

  2. On the Repository details page, click Manage repository located at the top-right corner of the screen.

  3. Click Transfer repository.

  4. Enter the Workspace ID of the workspace in which you want to transfer the repository.

  5. Click Transfer.

Bitbucket sends an email to the new owner or workspace administrators containing the transfer request with a link to the page that allows the user to accept or reject the transfer. If the account holder has administrative access on more than one account, he or she can transfer the repository into any of these accounts.

While the transfer is pending, the repository displays a banner with those details at the top to warn others who have access to your repository that a transfer is pending. You are able to revoke the transfer request at any time before the new user accepts it. If you revoke a transfer before a user accepts it, Bitbucket sends the user a notification that the transfer was rescinded.

Accept a transferred repository

If you receive a transfer request, accept it by doing the following:

  1. Open the transfer request email.

  2. Click the link provided to open the Transfer repository ownership screen. If you're not logged in to Bitbucket, you'll have to log in first.

  3. If the repository is being transferred to a workspace, pick a project.

  4. Click Accept.

Once you accept the request, the repository shows up on your list of repositories. Bitbucket updates all URLs on the server and the repository is accessible from its new location. The original owner of the repository will still have administrative access to the repository at its new owner/location. To change or remove this access, go to the repository's Repository settings > User and group access page. If you reject a transfer, Bitbucket sends a message to the sender of the request.

Update local configuration files with the new repository URL

When you transfer a repository, the Bitbucket URL changes. As a result, you need to update the local URL to maintain its connection with the remote repository.

The URL you use for a repository depends on which protocol you're using: HTTPS or SSH. You can find these URLs from the Clone button on the Source page of your repository.

You can click back and forth between the SSH and the HTTPS protocol links to see how the URLs differ. The table below shows how the formats vary based on protocol.

You'll see these names as part of the URL:

  • In place of <repo_name>, you'll see the repository name.

  • In place of <workspace_ID> in the HTTPS URL format, you'll see the workspace ID for your workspace.

Git repository URLs

HTTPS format

http//<your_username>@bitbucket.org/,workspace_ID/<repo_name>.git

SSH format

git@bitbucket.org:<workspace_Id>/<repo_name>.git

or

ssh://git@bitbucket.org/<workspace_ID>/<repo_name>.git


Update the URL for Git repositories

  1. From a terminal, navigate to the repository.

$ cd ~/<path_to_repo>

  1. Run git remote -v to see the current remote URL.

    $ git remote -v origin https://emmap1@bitbucket.org/tutorials/tutorials.git.bitbucket.org.git (fetch) origin https://emmap1@bitbucket.org/tutorials/tutorials.git.bitbucket.org.git (push)

  2. Update the remote URL with git remote set-url using the current and new remote URLs.

    $ git remote set-url origin git@bitbucket.org:tutorials/tutorials.git.bitbucket.org.git

If you update your URL from HTTPS to SSH, next time you push or pull from your repository, the terminal responds that it is adding the Bitbucket host to the list of known hosts. You also won't have to enter a password.

Still need help?

The Atlassian Community is here for you.