Blog atrasado con gajes del oficio

Git Committing by User Name Config

I recently had to set up again the local branches through git.

An error that was not uncommon came up on the screen:

 *** 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.

This time around it was done through configuring a user.name and a user.email on git itself.

It came to memory that the last time I was setting it up on a different system by pulling the sources from the remote branch, this configuration was never used.

An answer on stackoverflow reminded me that this was indeed the case the last time I had done it. See instead of doing a git pull you can do a git fetch

 git fetch
 git reset --hard origin/master

Even if the error from git with the please tell me who you are comes up after an ssh key is granted, as it was posted on this other thread entitled Git-please tell me who you are error when using ssh key, the best alternative is to specify the --global option from git as it posted at run git config –global user.email - git config –global user.name

Of course, if the option to have a --global configuration is not desirable, then the removal of this .gitconfig file may be accomplished through git again by issuing git config --global --unset-all user.name and git config --global --unset-all user.email from the terminal.

On the website that aims at answering questions about the ubuntu distributiion, there are more examples with this purpose. See for example git config global file - remove settings

The most important part about it lies on the command –unset-all, even though the answer which pointed at it was not the accepted solution in this case.

For more details about the config-file for git it is recommended to read the manual man git-config for more details.