I recently received this error when trying to commit a local GIT repository in SourceTree:
*** 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 'username@MACHINENAME.(none)')
This was weird as I had already used the indicated commands to set my commit options. Running “git config –global -l” in a Git Bash shell (I am running on Windows 10) resulted in the following:
$ git config --global -l user.name=My Name user.email="myemail@sixthimpulse.com" branch.autosetuprebase=always pull.rebase=true rebase.autostash=true
After a bit of searching online, I discovered one possible problem was my email address. Notice the quotation marks around the email address. When I configured my email address I used the following:
git config --global user.email "myemail@sixthimpulse.com"
All the examples showed the quotation marks. Instead, I should have left them off like the following:
git config --global user.email myemail@sixthimpulse.com
Now my global GIT config looks like this:
$ git config --global -l user.name=My Name user.email=myemail@sixthimpulse.com branch.autosetuprebase=always pull.rebase=true rebase.autostash=true
Unfortunately, that still didn’t work.
A bit more digging and I noticed that when I opened a Terminal window from inside SourceTree and tried to set my user.name, like so:
git config --global user.name "My Name"
I got an error back:
error: could not lock config file C:/WINDOWS/system32/config/systemprofile/.gitconfig: Permission denied
From there it was pretty simple to deduce that I needed to run SourceTree as an administrator and then I was able to commit just fine.
Not sure how this got changed, but at least I can commit now.