Change or transfer repository ownership

If you have administrative rights on a repository, you can change or transfer the ownership of a repository to another team or to a individual account. The account holder you are transferring to must accept the transferred repository to complete the transfer. You can revoke a pending transfer before it is accepted. Transferring a repository transfers the commit history, issue tracker, and wiki associated with that repository.

It is important to understand that changing a repository's ownership, changes the URL you (and others) use to access the remote repository from your local system. For example, if a repository is owned by the thecodemeister and the repository's name is coolcode, the URLs used to access the repository are the following:

After transferring coolcode from the thecodemeister to the newowneract account, the URLs look like this: 

Changing the ownership of a repository on Bitbucket changes information only on the Bitbucket Cloud server. Repository configuration files on local systems are not changed. This means, you must change local references to that repository manually or re-clone the repository after it changes.

Page contents:

How to transfer a repository

Make sure you know which user you want to transfer the repository to before you begin. Then, do the following:

  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 Username of the individual or team account you want to transfer to.

  4. Press Transfer.
    The Bitbucket server sends the user or team account an email notification containing a transfer request. The Transfer repository page changes to indicate that you have transferred the repository.

    Additionally, the system displays a pending transfer banner at the top of each repository tab. This warns 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.

What happens when a repository transfers?

When you transfer a repository to an account, Bitbucket sends an email notification to the account holder. The message contains a link to a page that allows the user to accept or reject the transfer. The account holder you transfer to may have administrative rights on multiple user or team accounts. If the account holder has administrative access on more than one account, then he or she can transfer the repo into any of these accounts.

When your transfer is accepted, Bitbucket automatically updates all the repository URLs on the Bitbucket site. The repository is accessible from it's new location – and the new owner's account name in the repository's URL. For example, suppose the location of the repo before transfer to newowneract is this: 

After transferring coolcode from the thecodemeister to the newowneract account, the URLs look like this: 

All the access rights are removed from the transferred repository and the previous administrator receives a notification of this change.

The new repository owner must configure the transferred repository's access permissions after receiving the transfer.

A transferred repository does not inherit the destination account's permission configuration.



Accepting a transferred repository

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

  1. Open the transfer request message.
  2. Click on the link provided. If you're not logged in to Bitbucket, you'll have to log in first.
  3. If the repository is transfering 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 choose to reject a transfer, Bitbucket sends a message to the sender of the request.


Updating local configuration files with the new repository location

The URL you use for a repo depends on which protocol you are using, HTTPS or SSH. You can find these URLs on the  Overview 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.

HTTPS URL format

SSH URL format

Mercurial https://<accountname><repo_owner>/<reponame> ssh:// /<repo_owner>/<reponame>/
Git https://<repo_owner><accountname>/<reponame>.git<repo_owner>/<reponame>.git



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.

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

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 Nov 8, 2017

Was this helpful?

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