Getting Started – First-Time Git Configuration
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
Your Identity
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 johndoe@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
user.email=johndoe@example.com
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 (/etc/gitconfig and ~/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
cat ~./gitconfig (it will return all records from config file)
Setup core editor, auto correct, ui color and auto crlf
$ git config --global core.editor vim
$ git config help.autocorrect 1 -> it execute right command if any typo mistake and words are almost similar.
$ git config --global color.ui auto
$ git config --global core.autocrlf true (For windows, it will correct only text files)
$ git config --global core.autocrlf input (For Mac, it will correct only text files)
$ cat ~./gitconfig (it will return all records from config file)
For remove any setting from config file
$ git config --unset core.autocrlf