312

I have app servers that I bootstrap together using Chef + some ad-hoc bash scripts. The problem is, when I want to run an update on one of these app servers, I get:

19:00:28: *** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

Do I really need to set this for doing a simple git pull origin master every time I update an app server? Is there anyway to override this behavior so it doesn't error out when name and email are not set?

4
  • 3
    From what I have encountered no, but then again I see no issue with just adding your name and email even if they are just fake names and emails.
    – sean
    Commented Jul 25, 2012 at 19:08
  • 11
    Yes, you have to set these, if the "simple" git pull is going to create a commit, because it did a merge, for example.
    – fork0
    Commented Jul 25, 2012 at 20:08
  • 1
    You describe scenario of one-way deployment. I would not add the credentials to avoid any automerging commits. Yes, you will see the problem with this error, but this will mean that someone is poking around production and changes files manually triggering the merge. Commented Feb 1, 2015 at 23:27
  • Check this out: stackoverflow.com/questions/42335599/…
    – Salar
    Commented Apr 21, 2021 at 7:00

26 Answers 26

346

I spent lots of hours on it when I call PHP script to init and commit to git. And I found the work flow should be as:

  1. git init
  2. git config user.name "someone"
  3. git config user.email "[email protected]"
  4. git add *
  5. git commit -m "some init msg"

If you swap [23] and 1, the config will not work at all.

I wish this will do some help.

3
  • 1
    This is the correct practice to init a git repository. But for updating a repo @gfxmonk solution is better
    – Davisein
    Commented Nov 21, 2014 at 11:28
  • Can you explain how is it working and why it was giving error before doing this?
    – Chinmaya B
    Commented Sep 19, 2016 at 20:34
  • 4
    You can add --global switch to git config commands, and do it once for your OS account. After that steps 2-3 are not needed.
    – x-yuri
    Commented Nov 9, 2016 at 20:17
81

Instead of doing a git pull, you can do:

git fetch
git reset --hard origin/master

Neither of those require you to configure your git user name / email.

This will destroy any uncommitted local changes / commits, and will leave your HEAD pointing to a commit (not a branch). But neither of those should be a problem for an app server since you shouldn't be making local changes or committing to that repository.

3
  • The automerge of git pull is dangerous in this situation, it's better to do a reset.
    – Davisein
    Commented Nov 21, 2014 at 11:30
  • Would it not be better to use git fetch && git reset --hard HEAD ?
    – jacoor
    Commented Oct 19, 2015 at 10:12
  • @jacoor nope: git reset --hard HEAD merely throws away your uncomitted changes, it doesn't change what commit your workspace is based on (since by definition you're already on HEAD)
    – gfxmonk
    Commented Feb 28, 2016 at 12:00
43

it works for me, try This.. you need to configure your terminal with remote access.

     git config --global user.name "abc"
     git config --global user.email "[email protected]"
1
  • It works for you, but it doesnt work for the OP. This is not helpful.
    – FrankU32
    Commented Jan 13, 2023 at 11:19
35

If you are using sourcetree: Repository -> Repository Settings --> Advanced --> uncheck "Use global user settings" box

worked great for me.

1
  • in my case I had to check it back, but anyway! Thanks for your help
    – narancs
    Commented Jun 5, 2017 at 16:32
17
git config user.email "insert github email here"
git config user.name "insert github real name here"

This worked great for me.

0
12

Update your bootstrap process to create a ${HOME}/.gitconfig with the proper contents, or to copy an existing one from somewhere.

0
6

In my case I was missing "e" on the word "email" as Chad stated above but I see its not the case with you. Please hit the following command to see if everything is pulling as expected.

git config -l
5

It is unable to auto-detect email address.

By default it takes your system username like [email protected].

So you need to set your email like below:

git config user.email "[email protected]"

After setting email you can run the git commands and commit your changes.

  1. git init
  2. git add *
  3. git commit -m "some init msg"
4

git pull should not require this. However if the pull causes a merge conflict, then it seems nessecary.

3

Same issue was with me and resolved it by adding default name and email Repository Settings.

As Doron suggested -

If you are using sourcetree: Repository -> Repository Settings --> Advanced --> uncheck "Use global user settings" box.

Add default name and email address.

3

For me the issue was network connection, once I reconnected to my wifi, it could fetch the details and commit without any issues.

2

I had this as a faulty error message:
git pull worked fine on the cmd line
git pull failed in a Perl CGI process (a webhook to auto-deploy from github) with the above error.

Doing a git status identified a clashing file. Sorting it fixed the problem.

Problem reoccurred later when I changed some config settings.

This time, setting $HOME and $USER env vars fixed it (are unset by default in a CGI process)

2

You must Write Your email like that

 git config --global user.email "[email protected]"

Then: Write Username

 git config --global user.name "Your Name"

After That Poupup window will appear

Write USERNAME & EMAIL For Acount YOU want contribute

2

I use Jenkins and ran into this problem when trying to perform a release (which requires a git commit). To fix the issues, I needed to add a Custom user name/e-mail address (see picture) Custom user name/e-mail address This ensured that when the code was checked out it used my build user's name/email address when performing the release. Note, this configuration is available from the Jenkins Multibranch Pipeline project configuration.

2

To Set config for this/current repo only just remove --global and set name/email like this:

$ git config user.name "John Doe" 
$ git config user.email "[email protected]" 
1

I ran into this error message whilst trying to commit some files.

Simply running git fetch then trying my commit again worked for me.

1

Have a look at the config file.

Repository > Repository Settings > Edit config file.

Check if the [user] section exists. If the user section is missing, add it.

Example:

[user]
name = "your name"
email = "your email"
1

i use heroku cli 1. must use all user name and user email

$git config --global user.email .login email.

$git config --global user.name .heroku name.

  1. git pull [git url]
  2. git init
  3. git add *

    5 git commit -m "after config user.name ,user email"

  4. git push heroku master

1

If you find the old default behavior useful (i.e. make commits with the local username and hostname as the author identification, instead of identifying you the person), you can run:

git config --global user.name "$USER" && git config --global user.email "$USER@$HOSTNAME"
1

This error occurs since git is not able to recognize the the user email and username, so you need to set the user using below commonds-

git config --global user.email "[email protected]"
git config --global user.name "Your Name"
0

Do I really need to set this for doing a simple git pull origin master every time I update an app server? Is there anyway to override this behavior so it doesn't error out when name and email are not set?

It will ask just once and make sure that the rsa public key for this machine is added over your github account to which you are trying to commit or passing a pull request.

More information on this can be found: Here

1
  • 1
    The link is broken Commented Feb 14, 2020 at 2:00
0

IMHO, the proper way to resolve this error is to configure your global git config file.

To do that run the following command: git config --global -e

An editor will appear where you can insert your default git configurations.

Here're are a few:

[user]
    name = your_username
    email = [email protected] 
[alias]
    # BASIC
    st = status
    ci = commit
    br = branch
    co = checkout
    df = diff

For more details, see Customizing Git - Git Configuration

When you see a command like, git config ...

$ git config --global core.whitespace \
    trailing-space,space-before-tab,indent-with-non-tab

... you can put that into your global git config file as:

[core]
   whitespace = space-before-tab,-indent-with-non-tab,trailing-space

For one off configurations, you can use something like git config --global user.name 'your_username'

If you don't set your git configurations globally, you'll need to do so for each and every git repo you work with locally.

The user.name and user.email settings tell git who you are, so subsequent git commit commands will not complain, *** Please tell me who you are.

Many times, the commands git suggests you run are not what you should run. This time, the suggested commands are not bad:

$ git commit -m 'first commit'

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

Tip: Until I got very familiar with git, making a backup of my project file--before running the suggested git commands and exploring things I thought would work--saved my bacon on more than a few occasions.

0

I had this error with git stash and I configured the settigs locally resp. for the repo

git config --local user.email "AppServer@your_domain.something"
#git config --local ...
git stash
#optionally unset to minimize risk of fake user commits ...
#esp if someone other than you uses the repo too
git config --local --unset user.email
#git config --local --unset ...

I did not have the error with git pull so I could not test if this would help then either

See also

What is the priority regarding git configuration?

Where do the settings in my Git configuration come from?

0

Perhaps someone will find the solution helpful. I use git as a part of my CGI scripts. I provided actions as recommended in all answers here, but no luck. I even used --author command option, but still git complained that : Committer identity unknown. Finally I guessed that git is looking for env key: HOME, but CGI engine doesn't setup the environment value. Git started working properly after adding HOME in git command run.

-1

To fix I use: git config --global user.email "[email protected]" and works.

user.mail no work, need to put an E. Typo maybe?

1
  • I think the OP wants to know if this is really necessary for each update.
    – tbrk
    Commented May 12, 2018 at 19:59
-6

That’s a typo. You’ve accidently set "user.mail" with no "e". Fix it by setting "user.email" in the global configuration with

git config --global user.email "[email protected]"

Found solution here

https://stackoverflow.com/a/14662703

1
  • 3
    Where do you see "'user.mail' with no 'e'" on this page?
    – Chad Nouis
    Commented Sep 4, 2015 at 14:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.