Why does the wrong username show in my commit messages?

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

   

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 the correct user, the email address you commit with locally must match a validated email address on your account. To associate your email address with local commits, Git allows you to configure 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.

For example, if your Bitbucket account has a validated email address of joe.foot@gmail.com, you can set your repository configuration for that username.

Whether or not you set a repository-specific value, make sure you set your global username/email address. If the global default is not configured or if you haven't validated your email address, the committer appears as unknown next to your commit. In addition, if you have multiple Bitbucket accounts, you may mistakenly commit your code under an email address that maps to an account you didn't intend. To map existing commits on a repository to a different account, you can add aliases to the Username aliases of the repository. To set up a username alias, you must have admin rights to the repository.

Steps to add an alias to a repository

To add an email alias to a repository, you'll need to first find the user's details.

  1. From the repository's Commits list, click a commit that the user pushed.

  2. From the commit page, click View raw commit.
    The raw commit string displays.

  3. Search for the From line and copy the user details.

Once you've got the user's details, you can add it to the repository in Bitbucket.

Only a user with admin access to a repository can add username aliases, and the user being added must have a Bitbucket account.

  1. From the repository, go to Repository settings.

  2. Click Username aliases.

  3. From the User column, search for the user account that you want to associate with the user who pushed the commit.

  4. From the Alias column, paste the user details you copied from the raw commit.

  5. Click Add.

When you return to the Commits list, you'll now see the mapped user account next to the commit. 

You may need to clear your browser cache for the mapped user account to display properly.

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, they must meet two conditions:

  1. You've configured Git 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.

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.

For more details on how to configure your DVCS username for commits please visit this page.

If the above instructions do not assist in resolving the issue, please raise a support ticket or raise a community support ticket for further assistance with this.

DescriptionWhy does the wrong username show in my commit messages?
ProductBitbucket Cloud





Last modified on Jan 24, 2024

Was this helpful?

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