Update your username

Each username is unique throughout Bitbucket Cloud. Your username appears in the URL for your personal repositories, as in https://bitbucket.org/<username/<repository>. Other users can also use your username to search for you.

After updating your username, previous news associated with the account gets removed. Anyone else following you or your repositories loses updates from before the username change.

This page

Changing your username changes every URL that references your repositories. As a result, you (and anyone who references the old URL) must update the URL in your configuration files as well, or you won't be able to push to the repository. For example, if you rename your account from johnc to jcitizen, the repository previously available at http://bitbucket.org/johnc/repo is accessed as http://bitbucket.org/jcitizen/repo after renaming.

You can't convert an individual account to a Bitbucket team and vice versa. As an alternative, you can Transfer repositories and groups to your team to reassign existing repositories to a team.

Updating your username is a two-part processYou update the username in Bitbucket and then in your configuration file.

Step 1. Update your username in Bitbucket

First, you change your username in Bitbucket.

  1. From your avatar in the bottom left, click Bitbucket settings.
  2. From the Account settings page, click change next to the Username.
  3. Enter your new Username.
  4. Click Rename.

You'll need to log out and log back in after making the change.

Step 2. Update the URL in your configuration file

If you don't update all configuration files that contain the old URLs, you'll get  an error when attempting to push your repository. If you don't want to edit the configuration file, you can also clone the repository from the new location. Be aware that you will lose any changes you made but had not pushed up to Bitbucket before the repository was transferred.
  Show me an example of how different URLs look

If you start with the coolcode repository in your personal account named the thecodemeister, then you move the repository to your newaweteam team, here's what your URLs look like before and after:

  Before change After change
Git SSH format

git@bitbucket.org:thecodemeister/coolcode.git

or

ssh://git@bitbucket.org/thecodemeister/coolcode.git

git@bitbucket.org:newaweteam/coolcode.git

or

ssh://git@bitbucket.org/newaweteam/coolcode.git

Git HTTPs format https://thecodemeister@bitbucket.org/thecodemeister/coolcode https://newaweteam@bitbucket.org/newaweteam/coolcode
Mercurial SSH format ssh://hg@bitbucket.org/thecodemeister/coolcode/ ssh://hg@bitbucket.org/newaweteam/coolcode
Mercurial HTTPs format https://thecodemeister@bitbucket.org/thecodemeister/coolcode https://newaweteam@bitbucket.org/newaweteam/coolcode

 

Step A. Get your new URL

If you aren't sure what your new URL is, you can look it up from the command line:

  1. Navigate to your repository's directory in a terminal window.

    $ cd <path_to_repository>
  2. Run the following command from your terminal window:

    $ git remote -v

You should get something similar to one of the following results:

For SSH
origin    git@bitbucket.org:teamsinspace/documentation-tests.git (fetch)
origin    git@bitbucket.org:teamsinspace/documentation-tests.git (push)
For HTTPS
origin    https://dans9190@bitbucket.org/teamsinspace/documentation-tests.git (fetch)
origin    https://dans9190@bitbucket.org/teamsinspace/documentation-tests.git (push)

Step B. Change your URL locally

To change your URL in the configuration file, you can do it from the command line:

  1. Navigate to your repository's directory in a terminal window.

    $ cd <path_to_repository>
  2. To modify the fetch URL, run the following command from your terminal window:

    For SSH
    $ git remote set-url origin git@bitbucket.org:{new team or account name}/{repository name}.git
    For HTTPS
    $ git remote set-url origin https://{username}@bitbucket.org/{new team or account name}/{repository name}.git
  3. To modify the push URL, run the following command from your terminal window:

    For SSH
    $ git remote set-url --push origin git@bitbucket.org:{new team or account name}/{repository name}.git
    For HTTPS
    $ git remote set-url --push origin https://{username}@bitbucket.org/{new team or account name}/{repository name}.git

Did you like this page? Give feedback!

Have a question about this article?

Ask our community
Powered by Confluence and Scroll Viewport