Gavriel Feria
Gavriel Feria

Reputation: 419

Problems with Git Commit

When I put off into git commit then I end up with this answer:

***Please tell me who you are.
Run:
   git config --global user.email "[email protected]"
   git config --global user.name "Your name"

Omit --global to set the name only in this repository.
fatal: unable to auto-detect email address (Got username@computername.<none>)

But when I run either of the options above, then run git commit I still end up with the above message. I ran them with just plain old git commit from cmd.exe. My OS is Windows Vista. Also my .gitconfig is in C:\Users\<username>\.gitconfig.

Upvotes: 2

Views: 1326

Answers (2)

user456814
user456814

Reputation:

If your .gitconfig file is located in a directory that is protected by User Access Control (UAC), then you might need to run your console with elevated permissions (as Administrator) in order to be able to modify/write to that file using

git config --global <setting>=<value>

For example, if you're using a Cygwin installation of Git, and you have your cygwin folder installed under

C:\Program Files (x86)\cygwin\

then your .gitconfig file might be located at

C:\Program Files (x86)\cygwin\home\<username>\.gitconfig

in which case you might need elevated permissions since it's located under a UAC protected folder, C:\Program Files (x86)\.

Beware, however, that some other installations of Git will change the location of a Cygwin drive default home directory (there's a Stack Overflow answer floating around somewhere about it, I'll link to it if I find it again). I've had the experience of installing either GitHub for Windows or msysgit, and then installing Cygwin, and either GitHub for Windows or msysgit set an environment variable that changed what Cygwin would use for a home directory to

C:\Users\<username>\

instead of

<cygwin directory path>\home\<username>\

Upvotes: 0

poke
poke

Reputation: 387507

If running the commands does not work—for whatever reason—then you can also enter the information yourself by editing the .gitconfig file.

Open up C:\Users\<username>\.gitconfig in a texteditor (not notepad.exe though), and add the following lines (with your information of course):

[user]
    name = Your Name
    email = [email protected]

If a [user] section is already in the file, try to merge it correctly so it isn’t duplicated.

Upvotes: 2

Related Questions