Configure your DVCS username for commits

When you make commits on your local system and push them to Bitbucket Cloud, the commit data determines which account name to attach to the push.

To ensure your commits in Bitbucket appear with your user account, it must meet two conditions:

  1. You've configured Git or Mercurial with a global username/email address and an optional repository-specific username/email address, as described on this page.
  2. You've added the email address as an email alias and validated it. See Set email aliases.

Otherwise, Bitbucket doesn't associate your account with the commit. Instead, the username attached to the commit will either be based on your computer username or only your DVCS username.

In the following image for example, the second (top) commit includes a mapped username with a validated email address. Alternatively, the user on the initial (bottom) commit was configured locally but isn't mapped. When you hover over the avatar or username, you'll see: Author not mapped to Bitbucket user.

Once you've pushed an unmapped commit to a repository, an administrator for that repository can add your email address as a username alias. See Map existing commits to username aliases for more details.

To associate your email address with local commits, start by configuring a global username/email and an optional repository-specific username/email. If you don't specify repository-specific values, the commit defaults to using the global values you set.

Configure your Git username/email

You typically configure your global username and email address after installing Git. However, you can do so now if you missed that step or want to make changes. After you set your global configuration, repository-specific configuration is optional.

Git configuration works the same across Windows, macOS, and Linux.

To set your global username/email configuration:

  1. Open the command line.
  2. Set your username:
    git config --global user.name "FIRST_NAME LAST_NAME"
  3. Set your email address:
    git config --global user.email "MY_NAME@example.com"

To set repository-specific username/email configuration:

  1. From the command line, change into the repository directory.
  2. Set your username:
    git config user.name "FIRST_NAME LAST_NAME"
  3. Set your email address:
    git config user.email "MY_NAME@example.com"
  4. Verify your configuration by displaying your configuration file:
    cat .git/config

Configure your Mercurial username/email

You typically configure your global username and email address after installing Mercurial. However, you can do so now if you missed that step or want to make changes. After you set your global configuration, repository-specific configuration is optional.

These steps apply to Mercurial configuration for macOS and Linux.

To set your global username/email configuration:

  1. Open the Mercurial configuration file: ~/.hgrc
  2. Add or update the username value with your full name and email address:

    username = first_name last_name <MY_NAME@example.com>

    When you're done, the [ui] section of the configuration file looks something like this:

    [ui]
    # Name data to appear in commits
    username = Emma Paris <emmap@atlassian.com>
  3. Save and close the file.

To set repository-specific username/email configuration:

  1. From the repository directory open the Mercurial configuration file: ~/<repo_directory>/.hg/hgrc
  2. Add or update the username value with your full name and email address:

    username = first_name last_name <MY_NAME@example.com>

    When you're done, the [ui] section of the configuration file looks something like this:

    [ui]
    # Name data to appear in commits
    username = Emma Paris <emmap@atlassian.com>
  3. Save and close the file.

Update your configuration from Sourcetree

Sourcetree adds your name and email address to your configuration files automatically when you log in with your Atlassian account. Use these steps if you'd like to update your global username/email or add a repository-specific username/email. After you set your global configuration, repository-specific configuration is optional.

To set your global username/email configuration:

  1. (macOS) From the Sourcetree menu, select Preferences.
    (Windows) From the Tools menu, select Options.
  2. Select the General tab if it's not already selected.
  3. Under Default user information, update your Full name and Email address.

To set repository-specific username/email configuration:

  1. From the repository in Sourcetree, click Settings.
  2. From the dialog that opens, select the Advanced tab.
  3. If Use global user settings is selected, remove the checkmark.
  4. Update Full name and Email address with the username/email details you want to use.
Last modified on May 17, 2018

Was this helpful?

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