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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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. 

3 answers

1 accepted

2 votes
Answer accepted
Tyler T Atlassian Team Feb 25, 2019

Check the contents of the file:

cat ~/.gitconfig

The format should look something like:

[user]
name = Firstname Lastname
email = name@example.com
[core]
etc....

As @Jobin Kuruvilla _Adaptavist_ suggested, it might be malformed and need manual updating.

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!

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

https://stackoverflow.com/questions/45174228/git-error-key-does-not-contain-a-section

[user] + [core]

 

# inner local project

$ vim .git/config

[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true

[user]
name = xgqfrms
email = xgqfrms@ufo.com

$ cat .git/config

 

$ vim ~/.gitconfig

# email = xgqfrms@ufo.com
# name = xgqfrms

[user]
  email = xxx@xxx.com
  name = xgqfrms

$ cat ~/.gitconfig

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,734 views 10 16
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you