global git config code example

Example 1: git config global

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

Example 2: git config

git config --global user.name "John Doe"
git config --global user.email [email protected]

Example 3: git user config

$ git config --local user.name "John Doe"
$ git config --local user.email [email protected]

Example 4: git config

$ git config --list --show-origin

Example 5: git global config location

To track down the file holding each config option set on your own system:
  git config --list --show-origin

Generally, there are three configs:
  * git config puts stuff in <repo root>/.git/config by default
  * git config --global puts stuff in <user home>/.gitconfig
    * On Linux/macOS, this means ~/.gitconfig
    * On Windows, this means %HOMEDRIVE%%HOMEPATH%\.gitconfig
      (not %USERPROFILE%\.gitconfig; these are not always the same)
  * git config --system puts stuff in a global config file shared by all users
    * On Linux, it's /etc/gitconfig
    * On macOS, it's /Applications/Xcode.app/Contents/Developer/usr/etc/gitconfig
    * On Windows, it's <wherever you installed Git>/etc/gitconfig

Example 6: git config

Open the command line.
Set your username: git config --global user.name "FIRST_NAME LAST_NAME"
Set your email address: git config --global user.email "[email protected]"