Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can't get past error message when trying to git global config username

Kris Lyle February 23, 2019

Trying to configure global user name and email but keep getting the same error message:

  • error: key does not contain a section: name
  • error: key does not contain a section: email

What am I missing? 

I'm on a Macbook Air (Mojave) using Terminal. 

4 answers

1 accepted

2 votes
Answer accepted
Tyler T
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 25, 2019

Check the contents of the file:

cat ~/.gitconfig

The format should look something like:

name = Firstname Lastname
email =

As @Jobin Kuruvilla [Adaptavist] suggested, it might be malformed and need manual updating.

Kris Lyle March 3, 2019

There were some lines that I had to delete in the gitconfig file (i.e. two empty, two with an outdated username and email).

Thank you!

1 vote
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 25, 2019

It is possible that the existing git config was tampered with. Check this answer:

0 votes
John Veber
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 13, 2024

For me the similar problem had the next reason:

Right after installing git, I made a mistake in one of the initial commands I tried to run:

$ git config --global "my name"  /* incorrect command */

I just forgot to give one of parameter, so even the .gitconfig file at my home directory wasn't created. The following command produced no output:

$ git config --list 

Just to highlight: this was an error in my first configuration command since installing the program.

The problem was solved by correct command:

$ git config --global "my name"

0 votes
xgqfrms October 10, 2020

[user] + [core]


# inner local project

$ vim .git/config

repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true

name = xgqfrms
email =

$ cat .git/config


xgqfrms October 10, 2020
$ vim ~/.gitconfig

# email =
# name = xgqfrms

  email =
  name = xgqfrms

$ cat ~/.gitconfig

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events