Last Updated: December 29, 2022
·
33.76K
· Chao Yang

Local & Global git config.

There are 2 git config we can use, local & global. If you have multiple git servers as me, you need to config your git as per folder bases. Or you can use global config.
For local git repo config, use:

git config user.name "your-user-name"
git config user.email "your-email-addr"

This will result in [user] section added to .git/config file:

[user]
name = your-user-name
email = your-email-addr

You can use global config also if you only have one git server.

git config --global user.name "your-user-name"
git config --global user.email "your-email-addr"

Then the [user] section will be present at ~/.gitconfig, with the same content as in the .git/config file.