What are git configs and why set them up?
Below are the basic configurations needed for Git Bash on Windows, commonly referred to as git configs. These steps are an initial setup that only needs to be completed once per machine or VM.
Configure username
- With Git Bash open, enter the following command:
git config --global user.name “FirstName LastName”
- Replace “FirstName” and “LastName” with your human-readable first and last name.
Configure e-mail
- With Git Bash open, enter the following command:
git config --global user.email email@address.com
- Replace “email@address.com” with your work e-mail address.
Configure an editor on Windows
With a defined username and email associated with signing your commits, you might want to utilize your favorite editor when writing those commit messages. The following instructions are for individuals using Git Bash when interacting with git repositories.
Using Visual Studio Code as your editor
- Instal Visual Studio Code.
- Open Git Bash.
- Enter the following command:
git config --global core.editor “code --wait”
Eclipse users
- Install Eclipse with EGit: https://www.eclipse.org/egit/download/
Other helpful configs
When you install newer versions of Git Bash on Windows, it will automatically set both of these up for you:
- Set your credential manager for Windows:
git config --global credential.helper wincred
- Windows and Unix operating systems handle line endings differently. You can tell git to automatically fix this issue for you.
For Windows, you set:
git config --global core-autocrlf true