Initial Installation and Configuration
Before you can use Git, you need to install it on your computer locally and configure it so it knows who you are.
1. Download and Installation
- Windows: Download the installer from git-scm.com. The default installation (leaving everything on "Next") includes Git Bash, which is the terminal we recommend using instead of CMD or PowerShell.
- macOS: The easiest way is to install or open Xcode Command Line Tools. Simply open the terminal and type
git --version. If you don't have it, a prompt will pop up to install it. - Linux (Ubuntu/Debian):
sudo apt update
sudo apt install git
2. Configure your Identity (Very Important!)
Git records who makes each change. If you don't configure your name and email, Git will not let you create versions or you will have problems when you try to push your code to GitHub.
Open your terminal (or Git Bash on Windows) and run these two commands, replacing them with your real data:
# Configure your full name or alias
git config --global user.name "Your Name Here"
# Configure your email address (Use the same one from your GitHub account)
git config --global user.email "your_email@example.com"
Using the --global flag means that you will only have to do this once on your entire computer. All projects will use that information.
3. Configure the Default Main Branch (Optional but recommended)
Historically, Git called the main branch master. Today, the industry standard (and GitHub's) is to call it main. You can configure Git to always use main when creating new projects:
git config --global init.defaultBranch main
4. Verify your Configuration
If you want to be one hundred percent sure that your credentials were saved correctly, run:
git config --list
You should see your user.name and your user.email listed there. Congratulations! You are now ready to create your first repository.