Syncing two repos in Pipelines error "unable to auto-detect email address"

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

Summary

When trying to regularly sync the main repository to the forked repository via pipelines, the pipeline could error out with the following error:

ℹ️ This is applicable when the clone in the Bitbucket Pipelines is turned off, Build Setup step

Output from local docker container similar to pipelines

1 2 3 4 5 6 7 8 9 10 11 12 13 root@35a7d8191b2d:/opt/atlassian/bitbucketci/agent/build/a-fork# git merge parent/master *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'root@35a7d8191b2d.(none)')

Cause

When "clone" is disabled in pipelines, the git configuration for "user.email" and "user.name" is not defined. When this happens, GIT does not know who to assign an author to the commit if it needs to generate one.

Run this command to verify if the config is configured:

1 2 git config --list --show-origin | grep user.email git config --list --show-origin | grep user.name

GIT has a mechanism to fall back to create its own email when user.email is not configured instead of throwing an error. As per the Git Internals Environment Variable document, it says:

EMAIL is the fallback email address in case the user.email configuration value isn’t set. If this isn’t set, Git falls back to the system user and host names.

The EMAIL environment variable is used for the fallback email, which it constructs using the system user and hostname. As per the GIT Source Code, it creates the email in the following format:

1 [(username of logged in user) + @ + hostname + . + domain name (FQDN)]

If no FQDN is set, it will add ".(none)" as the TLD domain name, such as "root@35a7d8191b2d.(none)".

ℹ️ FQDN - Fully Qualified Domain name

This results in the error:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # hostname - Prints hostname configured # hostname -A - Prints FQDN root@35a7d8191b2d:/opt/atlassian/bitbucketci/agent/build/a-fork# hostname 35a7d8191b2d root@35a7d8191b2d:/opt/atlassian/bitbucketci/agent/build/a-fork# hostname -A 35a7d8191b2d root@35a7d8191b2d:/opt/atlassian/bitbucketci/agent/build/a-fork# git merge --no-edit parent/master *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got 'root@35a7d8191b2d.(none)')

Solution

There are two ways solution this error :

  1. Configure user.config and user.name in your git config. Typically, this is configured at the Global level, but it can be configured at the system's or local level based on the preference.

    1. Example:

      1 2 git config --global user.email "johndoe@example.com" git config --global user.name "John Doe
  2. Another method is to configure an FQDN in the machine or docker container. The easiest way is to edit the host file.

    1. The example below is the automated configuration of it in a non-interactive docker container, just like how it can be done in Bitbucket Pipelines.

    2. 1 2 3 4 5 6 - hostname -A # Verify that FQDN is not configured - hostname=$(hostname) && echo $hostname # Set hostname variable - cp /etc/hosts ./hosts.new # Copy hostname to a new directory to update it - sed -i "s/$hostname/${hostname}.com $hostname/g" ./hosts.new && cat hosts.new # Update hosts file with the FQDN - hostname && hostname -A # Verify that FQDN is configured - cp -f ./hosts.new /etc/hosts #this overwrites the "/etc/hosts" file. Ensure to have a backup of it if needed.

If you are encountering issues following this documentation - please raise a support ticket or a community support ticket for further assistance.

Updated on April 11, 2025

Still need help?

The Atlassian Community is here for you.