In this section, we will prepare your local environment to work with Git.
First, let's confirm your Git Installation:
$ git --version $ git version 2.11.0
If you do not see a git version listed or this command returns an error, you may need to install Git.
To get the latest version of Git, visit www.git-scm.com.
Git allows you to set configuration options at three different levels.
These are system-wide configurations. They apply to all users on this computer.
These are the user level configurations. They only apply to your user account.
These are the repository level configurations. They only apply to the specific repository where they are set.
The default value for git config is
If you would like to see which config settings have been added automatically, you can type
git config --list. This will automatically read from each of the three config files and list the setting they contain.
$ git config --list
You can also narrow the list to a specific configuration level by including it before the list option.
$ git config --global --list
Git uses the config settings for your user name and email address to generate a unique fingerprint for each of the commits you create. You can't create commits without these settings:
$ git config --global user.name "First Last" $ git config --global user.email "email@example.com"
The instructions for this exercise use the
--global flag when identifying your
user.email configuration settings. If you are currently using a computer without a private, personal account, don't apply the
--global flag. This way, the settings will only be stored in our assignment repository. If you work in another repository on this same computer, you will need to set these configuration options again.
git config user.email "firstname.lastname@example.org"
Your name and email address will automatically be stored in the commits you make with Git. If you would like your email to remain private, GitHub allows you to generate a no-reply email address for your account. Click the Keep my email address private in the Settings > Emails section. After enabling this feature, you just need to enter the automatically generated
IDemail@example.com when configuring your email.
git config --global user.email firstname.lastname@example.org
$ //for Windows users $ git config --global core.autocrlf true $ //for Mac or Linux users $ git config --global core.autocrlf input
Different systems handle line endings and line breaks differently. If you open a file created on another system and do not have this config option set, git will think you made changes to the file based on the way your system handles this type of file.
autocrlfstands for auto carriage return line feed.