In this article, we will see how to solve git pull "fatal: unable to auto-detect email address"
error. If you have freshly installed git in your system and trying to perform git operations such as git pull to pull the changes from remote branch in a repo to local branch then it is possible that you may encounter error like "fatal: unable to auto-detect email address"
and then it won't allow you to do any commit until you fix this error.
This is something happened with me as well and hence it is important to understand this error and fix it. I am going to explain this error and provide you the solution so that it won't occur again. Let's see it through my use case scenario to understand it better.
Solved git pull "fatal: unable to auto-detect email address" error
Also Read: Solved "git push error: RPC failed: HTTP 500 curl 22 The requested URL returned error"
In my case, I was trying to pull the changes from remote branch release-2.1.2
to my local branch without any fast forward using git pull origin release-2.1.2 --no-ff
command but I ended up with fatal: unable to auto-detect email address (got 'cyberithub@macos1066.(none)')
error on the output as shown below.
cyberithub@macos1066 % git pull origin release-2.1.2 --no-ff From https://app.cyberithub.com/bitbucket/scm/application/example-app * branch release-2.1.2 -> FETCH_HEAD Committer identity unknown *** 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 'cyberithub@macos1066.(none)')
This issue usually happens when you setup your git
for the first time and did not configured your account identity. Since this identity is required to perform the commit in your remote repository branch, you have to first configure your email id
and name
before performing any operations in git repo. In my case, to fix this issue, I have configured my email id
and name
using git config
command as shown below. If you are looking to set the identity only for current working repository then you can omit --global
from below command.
cyberithub@macos1066 % git config --global user.email "admin@cyberithub.com" cyberithub@macos1066 % git config --global user.name "CyberITHub"
After setting up the identity, I tried again to pull the changes from remote branch and this time changes from remote branch merged with local successfully as you can see below. This fixed my issue. Hopefully it will fix yours as well.
cyberithub@macos1066 % git pull origin release-2.1.2 --no-ff From https://app.cyberithub.com/bitbucket/scm/application/example-app * branch release-2.1.2 -> FETCH_HEAD Merge made by the 'ort' strategy. config/test.yaml | 2 +- config/hello.yaml | 2 +- 2 Files changed, 4 insertions(+), 4 deletions(-)
Please do let me know if it helped you in any way and in case if you have any suggestions/feedback on this.