user128177
user128177

Reputation: 13

git config user.name gives wrong user name

I started using git on the command line. And am trying to configure user name.

For example, inside my git repository directory, I ran

git config --global user.name lzeng

However, running "git config user.name" gives "defaultuser". But I just set it to "lzeng". How can that be?

Upvotes: 1

Views: 1556

Answers (2)

Use this file as a point of reference. The syntax for the config file is not the same as the commands for the terminal.

https://gist.github.com/pksunkara/988716

Upvotes: 0

kgf3JfUtW
kgf3JfUtW

Reputation: 14926

But I just set it to lzeng. How can that be?

Running git config --global user.name lzeng sets user.name to lzeng at global level. Try running git config user.name lzeng. It will set the variable at local/repository level. Then when you run git config user.name, it should return lzeng.

If you run git config --list --show-origin, you should see user.name defined twice. The last of those definitions will take effect. Chances are that user.name is somehow set to defaultuser at local level (check your .git/config file).


Reference: 1.6 Getting Started - First-Time Git Setup

Upvotes: 6

Related Questions