152

I just cannot commit with git on Ubuntu 14.04

Error message is:

git: fatal unable to auto-detect email address (got "some wrong email")

I tried git-config with and without the --global option setting user.name and user.mail but nothing works

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
user2428094
  • 1,643
  • 2
  • 10
  • 6
  • possible duplicate of [Why Git is not allowing me to commit even after configuration?](http://stackoverflow.com/questions/14662526/why-git-is-not-allowing-me-to-commit-even-after-configuration) – Chris Sep 04 '14 at 17:46

18 Answers18

220

Probably a typo mistake: set user.mail with no e. Fix it by setting user.email in the Global Configuration with

$ git config --global user.email "you@example.com"

Already been asked: Why Git is not allowing me to commit even after configuration?

To be sure Run:

$ git config --local -l
the_mishra
  • 813
  • 9
  • 24
Jofe
  • 2,489
  • 1
  • 12
  • 12
53

Make sure you should be in your home directory not in local directory. while setting your username and e-mail ID.

git config --global user.email "you@example.com"
git config --global user.name "github_username"

Then follow the procedure on GitHub.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
38

If git config --global user.email "you@domain.com" git config --global user.name "github_username"

Dont work like in my case, you can use:

git config --replace-all user.email "you@domain.com"
git config --replace-all user.name "github_username"
21

fatal: unable to auto-detect email address (got 'jsiddharth@TheDEN.(none)')

I ran the following,

git config --global user.email "myemailid@example.com"
git config --global user.name "my name"
repo init -u https://example.com/platform/manifest
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Siddharth
  • 9,349
  • 16
  • 86
  • 148
11

I get this error when running git stash. Fixed with:

git config --global user.email {emailaddress}
git config --global user.name {name}
Giacomo1968
  • 25,759
  • 11
  • 71
  • 103
Vinay Vemula
  • 3,855
  • 1
  • 21
  • 24
5

I had this problem yesterday. Before in the my solution, check this settings.

git config --global user.email "your_address_email@example.com"
git config --global user.name "your_name"

Where "user" is the user of the laptop.

Example: dias@dias-hp-pavilion$ git config --global dias.email ...

So, confirm the informations add, doing:

dias@dias-hp-pavilion:/home/dias$ git config --global dias.email
my_address_email@example.com
dias@dias-hp-pavilion:/home/dias$ git config --global dias.name
my_name

or

nano /home/user_name/.gitconfig

and check this informations.

Doing it and the error persists, try another Git IDE (GUI Clients). I used git-cola and this error appeared, so I changed of IDE, and currently I use the CollabNet GitEye.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Tairone Dias
  • 151
  • 1
  • 2
5

Problem solved after I run those commands with sudo

  • Strange solution. 'git-config --global' does not relate to all users of the local system, but all repositories and all remotes of the logged in user, see e.g. https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration: "The next place Git looks is the ~/.gitconfig (or ~/.config/git/config) file, which is specific to each user. You can make Git read and write to this file by passing the --global option." I recommend not to use git as root, better control, if one of these files exist and if you have the rights to edit them. – Jochen Haßfurter Sep 23 '20 at 07:01
2

Had similar problem, I'm fairly new so take this with a grain of salt but I needed to go up a directory first, set the username, then go back down to git repository.

cd ..    
git config --global user.email "your_address_email@domain.com"
git config --global user.name "your_name"
cd <your repository folder>

Hope this helps anyone else that gets stuck

Joshua S
  • 21
  • 1
1

I met the same question just now,my problem lies in the ignorance of blank behind the "user.email" and "your_address_mail@domain.com".

 git config --global user.email "your_address_email@domain.com"

I hope it will help you.

1

I'm running Ubuntu through Windows Subsystem for Linux and had properly set my credentials through Git Bash, including in VS Code's terminal (where I was getting the error every time I tried to commit.)

Apparently even tho VS is using Bash in the terminal, the UI git controls still run through Windows, where I had not set my credentials.

Setting the credentials in Windows Powershell fixed the issue

Chase
  • 2,051
  • 2
  • 21
  • 26
0

Steps to solve this problem

note: This problem mainly occurs due to which we haven't assigned our user name and email id in git so what we gonna do is assigning it in git

  1. Open git that you have installed

  2. Now we have to assign our user name and email id

  3. Just type git config --user.name <your_name> and click enter (you can mention or type any name you want)

  4. Similarly type git config --user.email <xyx@gmail.com> and click enter (you have to type your primary mail id)

  5. And that's it.

    Have a Good Day!!!.

Community
  • 1
  • 1
0

just put $ git config --local -l first in working directory and then run config.

Flame alchemist
  • 107
  • 1
  • 4
0

Just type 2 lines in git bash for example:

$ git config --global user.name "Nguyen Duc Mui"
$ git config --global user.email "ducmui@tnut.edu.vn"

and run again

$ git commit -a -m "Initial commit. Added a gitignore file and a README file."
Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
0

Just ran into this error, i was aware of the config steps. I copy/pasted it but still getting Authors identity unknow error followed by unable to auto-detect email address. I quickly figured out that i copied some spaces characters before the config commands which made them fail but they didn't issue any warning.

Just removed spaces and it worked.

0

This commit help me to solved this issue.

git config --global user.email "Your email address of Github" git config --global user.name "Your username of Github"

0

My error was from pulling a repository having different remote origin. Like GIT file has the origin_1 but current (local) folder had the origin_2. The actual error message was "fatal: unable to auto-detect email address (got 'root@isi-D-002.(none)')".

I fixed with (basically without --global):
sudo git config user.email <my e-mail for current remote repository>

Cloud Cho
  • 1,594
  • 19
  • 22
-1

1st Step : Go for the workstation In my case -> cd /c/Users/rashni/MyWS/WSpace

2nd Step : create a folder In my case -> mkdir config

3rd step : use command In my case -> git config --global user.name "rashni" In my case -> git config --global user.email rashni@abc.com

4th step : To check all configuration(optional) In my case -> git config --list

-1

For Visual Studio users:

  1. Open Visual Studio
  2. Click on Git menu > Source Control > Git Repository Settings > General
  3. Set the 'User name' and 'Email'
  4. Click 'OK'
Tarzan
  • 4,270
  • 8
  • 50
  • 70