git global config not working

If I create a new repo and attempt the first commit I get this error..

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

however I know the global config is run, and even re-running those commands doesn't fix it. If I run

git config -l

I can see my email and name is already set ok.

It does work though if I omit the --global param and therefore set my email and name explicity for the current repository. So i have to do that every time I create a new repo for it to work.

Am new to git so may have this wrong but assumed that it should be able to pick up the global settings so I don't have to re-tell it my email and name for each repo?

1 answer

1 accepted

This widget could not be displayed.

FYI I fixed this in the end by changing my HOME environment variable. It was set to %UserProfile% which I assume git doesn't like so I changed it to explicity say C:\Users\Martin and then it all worked

Thanks for the information, Martin. You may not have been running the same Git instance as the version you use at the command line. As we run Git in a separate process it doesn't honour environment variables like that. I haven't got an instance of the Windows version but I presume there'd be a preference which allows SourceTree to modify your Git/Mercurial settings which may not be set. You can also set your user information (e-mail/username) in there too, usually.

Glad you've got it working otherwise.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

891 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you