Configuring Git credentials
If you've never used Git before, first you need to set up your name and email. This information is used to identify you as the author of the changes you make in the repository.
The name and email address are stored in the Git configuration. There are global settings, which apply to all repositories on your computer, and local settings, which apply only to a specific repository. Such separation may be handy when you want to use your work email address for work projects and your personal email address for personal projects.
You can view or change the configuration using the git config
command. By default, it works with the configuration of the current repository. But if you pass the --global
option, that will set the global configuration value, which will be used in all repositories, unless a specific repository overrides the value. This may be handy when you use separate Git credentials for work and personal projects.
Run the following command to let Git know your name. Here, user.name
is the name of the parameter we're going to change. Make sure to replace Your Name
with your actual name.
git config --global user.name "Your Name"
Don't forget quotation marks around your name. They let you submit the full name with spaces. From the perspective of the command, "John Smith"
is a single argument, whereas John Smith
is two separate arguments: John
and Smith
. This command is programmed to accept just one argument, so it will fail if you don't use quotation marks.
You can use non-latin characters in your name (such as "孔子"
), as long as the argument is enclosed within quotation marks.
Set your Git user name.
Run the following command to let Git know your email address. Make sure to replace you@example.com
with your actual email.
git config --global user.email "you@example.com"
Set your Git user email address.