git config
Set up git: the author name and email, the editor and other settings
What it does
git config reads and changes git settings. The first thing to set after installing is your name and email: they go into every commit and show who did what.
With --global a setting is saved for all your repositories, in ~/.gitconfig. Without it the setting applies to the current repository only and wins over the global one: that is how you use your work email in a work project. git config --list shows every setting in effect.
Syntax
git config --global <key> <value>
git config <key> <value>
git config --listExamples
Set the name Anna for all commits on this computer
git config --global user.name "Anna"same as:
git config --global user.name 'Anna',git config --global user.name Annaconfig— git settings--global— for all of the user’s repositoriesuser.name "Anna"— key and value
Set the email anna@example.com for all commits
git config --global user.email anna@example.comsame as:
git config --global user.email "anna@example.com"--global— for all of the user’s repositoriesuser.email— commit author’s email
Related commands
- git init — Create a new repository in the current folder
- git commit — Save the staged changes to history as a new commit