# Setup
In order to start working with git, you need to install it globally in your system
Git for Windows (opens new window)
Git for Mac (opens new window)
Now that you have Git on your system, you need to do a few things to customize your Git environment. You need to do these things only once on your computer, and they will stick between updates. You can also change them at any time by running the corresponding commands again.
Git comes with a tool called git config, which allows you to get and set configuration variables that control the look and feel of Git. These variables can be stored in three different places:
/ Etc / gitconfig
file: Contains values for all system users and all their repositories. If you pass the --system
option to git config, it specifically reads and writes to this file.
~ / .Gitconfig
or~ / .config / git / config
file: This file is specific to your user. You can make Git read and write specifically to this file by passing the --global
option.
Config file in the git directory (that is, .git / config
) of the repository you are currently using: This file is specific to the current repository.
Each level overwrites the values of the previous level, so the values in .git / config take precedence over those in / etc / gitconfig
.
On Windows systems, Git looks for the .gitconfig file in the \ $ HOME directory (for many people it will be (C: \ Users \ $ USER
). It also looks for the/ etc / gitconfig
file, although this path is relative to the MSys root, which is where you decided to install Git on your Windows system when you ran the installer.
Your identity The first thing you'll need to do when installing Git is to set your username and email address. This is important because Git commits use this information, and it is immutable in the commits you submit:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
Again, you only need to do this once if you specify the --global
option, since Git will always use this information for everything you do on that system. If you want to overwrite this information with another name or email address for specific projects, you can run the command without the --global
option when you're in that project.
← Introduction Repo →