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.
Hi! I'm Alex, creator of GitByBit.
This page is a part of the interactive course about Git version control.
It's a one-of-a-kind course that is integrated into the VS Code code editor. Learning directly in VS Code lets you operate Git exactly as you would in real life, doing real jobs, writing real code.
In addition, the course has access to your actual terminal, so it can point out mistakes, suggest workarounds, etc.
The course is FREE, there are no Ads or other bullshit. There are optional premium add-ons you can purchase, mainly to support my work (regrettably, I have to eat every day), but that's totally up to you.