The git initial setup is performed only once after the installation is successful. This post will focus on the minimum set of properties that should be configured before you can use git.
Scenario: Initial Setup
After you have successfully installed Git, you first need to configure the username and email properties. These properties are used as part of the commits to the different repositories. To perform the initial setup, run the following commands:
Step 1: Setup Your Identity
Git requires you to setup your user name and email address before you can use git. The reason for this is that git uses this information as part of the commit function. To set your user name and email address, run the following commands within the terminal.
$ git config --global user.name "Star-Lord" $ git config --global user.email "firstname.lastname@example.org"
To ensure that your identity has been set correctly, you can execute the command below within a terminal. This command prints the user name, that has been set in the Global config file, out to the console.
$ git config user.name Star-Lord
This command prints the user email address, that has been set in the Global config file, out to the console.
$ git config user.email email@example.com
Step 2: Setup Line Ending Properties
Windows uses both a carriage-return character and a linefeed character for newlines in its files, whereas Mac and Linux systems use only the linefeed character. These properties ensure that will not run into line-ending issues when multiple people are working on both Windows, Unix and Mac.
$ git config --global core.autocrlf input $ git config --global core.safecrlf true
$ git config --global core.autocrlf true $ git config --global core.safecrlf true
Step 3: Print All Properties
Alternatively, the following command can be used to list all the properties that has been set in the global configuration file.
$ git config --global --list user.name=Star Lord firstname.lastname@example.org
The following git commands are used to perform the initial setup of git by setting the user name and email properties.
The intent of this page is to focus on the initial setup required by git before you can start using it. The minimum settings required for Git to work are the user name and email. For more information about git and the other properties you can set, please look at the official documentation that can be found at the following link: