To use Git, you just need to install it on your machine and tell it who you are.
Installing Git
- Go to the official website, git-scm.com, under Downloads.
- Pick your system, then the 64-bit version (unless your machine is 32-bit). Take the regular installer, not the “portable” version.
- Run the installer. A standard installation is enough: keep the default options.
Checking the installation
git --version
# git version 2.30.1.windows.1
If the command prints a version, Git is installed.
Setting your identity
As we saw in the previous chapter, Git records who makes each change. So you need to give it your name and email:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
--globalapplies the setting to all your projects on this machine.- This name and email will appear in every commit and push you make.
Use the same email as your GitHub account: your commits will then be linked to your profile.
To check your configuration:
git config --global --list
Exercise · Check your identity
Show the name and email Git will use for your next commits.
Show the solution
git config --global user.name
git config --global user.email
With no value after the setting’s name, git config shows the current value instead of changing it.
What’s Next
Git is ready! In the next chapter, we use it on a real project: clone, create a branch, commit and push.
This is Chapter 2 of the Git in Practice course. Follow along to learn how to use Git every day and as a team.