Your commits happen on your local system and you push them to Bitbucket Cloud. Bitbucket uses the commit data to determine which account name to attach to the push in Bitbucket. To ensure your actions in Bitbucket appear with the correct user, you must configure your local DVCS correctly.

This page contains the following topics:

Git username/email configuration

Configuring Git works the same across GitBash (Windows) , Mac OS X, and Linux-based systems. To set your global username/email configuration, do the following:

Configure repository-specific values

To configure repository specific values, do the following:

  1. Change directory to the root of the repository.
  2. Run the following command:
    git config user.name "FIRST_NAME LAST_NAME"
  3. Run the following command:
    git config user.email "MY_NAME@example.com"
  4. Verify your configuration by display your configuration file:
    cat .git/config

Mercurial username/email configuration

If you are using TortoiseHg in Windows, do the following to set global repository values:

For Mac OS X and Linux systems do the following to set global repository values:

  1. Edit the Mercurial configuration file ~/.hgrc (installed by MacPorts) using your favorite editor.
  2. Specify a username value.
    When you are done, the configuration file looks something like this:

    [ui]
    # Name data to appear in commits
    username = Mary Anthony <manthony@atlassian.com>
  3. Save and close the file.
Configure repository-specific values

If you are using TortoiseHg in Windows, do the following:

  1. Start TortoiseHG.
  2. Right click your repository and choose Settings.
    The system displays the TortoiseHG Settings dialog with the NAME repository settings tab active.
  3. Press Edit File.
  4. View your current repository configuration.

  5. Change the username value to the value you want to use for that repository.
    When you are done you should see something similar to the following:

    [ui]
    # Name data to appear in commits
    username = Mary Anthony <manthony@atlassian.com>
  6. Press Save to close the editor.

  7. Press OK to close the settings dialog.

If you are using Mac OS X or a Linux OS, do the following:

  1. Open a terminal window.
  2. Edit the Mercurial global configuration file (REPO_INSTALLDIR/.hg/hgrc).
  3. Add the following line to the UI section:

    ssh = ssh -C

    When you are done the file should look similar to the following:

    [ui]
    # Name data to appear in commits
    username = Mary Anthony <manthony@atlassian.com>
    ssh = ssh -C
  4. Save and close the file.

Alias configuration

Only a user with admin permissions for repository can create an alias configuration. An alias is just for that repository; other repositories do not share that alias. Aliases are case sensitive, to alias commits from foo@bar.com as well as FOO@BAR.COM, you must create two separate aliases. For example, let's assume you used to be foo@bar.com and you used that as your DVCS username. Now, you switched to a different email address and updated your Bitbucket account accordingly. Commits under the old email address are no longer linked to you:

Identify the Author you want to alias and find the author's committer string. To do this:

  1. Locate the Author in the Commits list.
  2. Click on the corresponding Commit.
    The Commit panel appears.
  3. Click on the raw commit link.
    The raw commit string passed to Bitbucket displays.
  4. Locate the User section and select the information in it.
  5. Copy to your clipboard.

To make sure Bitbucket knows that these old commits were yours, go to the repository administration section and create a custom alias that maps foo@bar.com to your account.

  1. Log in as the repository administrator.
  2. Go to the repository where you want to set up an alias.
  3. Go to the repository  settings.
  4. Click Username aliases.
  5. Enter the Username for the Bitbucket user you want to appear as the Author.
    In this example, I want the tutorials user to show up for my other users. So, I enter tutorials.

  6. Enter the Alias for this user.
    Paste the User data from the raw commit.

  7. Press Add alias.

After this alias configuration, Bitbucket correctly links your commit for this repository: