Transfer repository ownership

If you have administrative rights to a repository, you can change or transfer the ownership of a repository to another team or to a 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 Settings in the left menu.
  2. From the Repository details page, scroll down and you'll see Transfer or delete repository. Click Transfer repository to open the Transfer repository window.
  3. Enter the Owner, either the username of the individual or team ID, to whom you want to transfer the repository.
  4. Press Transfer.

Bitbucket sends an email to the new owner or team 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 transferring to a team, pick a project.
  4. Press 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 it's new location. The original owner of the repository automatically has delegated administrative access to the repository at its new owner/location. To change or remove this access, go to the repository's 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 <your_username> in the HTTPS URL format, you'll see the username for your individual account.
  • In place of <account_name> for all URL formats, you'll the user or team name for the account that owns the repository.
    <your_username> and <account_name> may be the same if you're looking at the URL for a repository you own.
Git repository URLs
HTTPS format https://<your_username><account_name>/<repo_name>.git
SSH format<account_name>/<repo_name>.git



Mercurial repository URLs
HTTPS format https://<your_username><account_name>/<repo_name>
SSH format ssh://<account_name>/<repo_name>/

Update the URL for Git repositories

  1. From a terminal, navigate to the repository.

    $ cd ~/<path_to_repo>
  2. Run git remote -v to see the current remote URL.

    $ git remote -v
    origin (fetch)
    origin (push)
  3. Update the remote URL with git remote set-url using the current and new remote URLs.

    $ git remote set-url origin

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.

Update the URL for Mercurial repositories

  1. From your terminal, view your current repo configuration.
    You should see something similar to the following:

    $ cd ~/<path_to_repo>
    $ cat .hg/hgrc
    default =

    In the previous example, the default URL is using the HTTPS protocol.

  2. Open the ~/<path_to_repo>/.hg/hgrc file with your favorite editor.
  3. Change the default value to the URL you want to use for that repository. When you are done you should see something similar to the following:

    default = ssh://
  4. Save and close the configuration file.

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.

Last modified on May 10, 2018

Was this helpful?

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