Getting Started – First-Time Git Setup
Now that you have Git on your system, you’ll want to do a few things to customize your Git environment.
Git comes with a tool called
git config that lets you get and set configuration variables that control all aspects of how Git looks and operates.
On Windows systems, Git looks for the gitconfig file in the home directory c:\users\$user
You can view all of your settings and where they are coming from using:
$ git config --list --show-origin
The first thing you should do when you install Git is to set your user name and email address. This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating:
$ git config --global user.name "John Doe" $ git config --global user.email email@example.com
Again, you need to do this only once if you pass the
--global option, because then Git will always use that information for anything you do on that system. If you want to override this with a different name or email address for specific projects, you can run the command without the
--global option when you’re in that project.
Checking Your Settings
If you want to check your configuration settings, you can use the
git config --list command to list all the settings Git can find at that point:
$ git config --list user.name=John Doe firstname.lastname@example.org color.status=auto color.branch=auto color.interactive=auto color.diff=auto ...
You may see keys more than once, because Git reads the same key from different files (
~/gitconfig, for example). In this case, Git uses the last value for each unique key it sees.
You can also check what Git thinks a specific key’s value is by typing
git config <key>:
$ git config user.name John Doe