This guide will walk you through installing Git and setting up your GitHub account.
- Download the installer from the official Git website
- Run the installer and follow the installation wizard
- During installation, you can keep most default settings, but consider these options:
- Choose "Git from the command line and also from 3rd-party software"
- Choose "Use the OpenSSL library" for HTTPS connections
- Choose "Checkout Windows-style, commit Unix-style line endings"
- Choose "Use Windows' default console window"
- Enable "Git Credential Manager"
brew install git- Download the installer from the official Git website
- Run the installer and follow the installation wizard
sudo apt update
sudo apt install gitsudo dnf install gitTo verify Git is installed correctly, open a terminal or command prompt and run:
git --versionYou should see output displaying the installed Git version.
After installing Git, set up your identity with these commands:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"Optional but recommended configurations:
# Set default editor (replace with your preferred editor)
git config --global core.editor "code --wait" # For VS Code
# Set default branch name to main
git config --global init.defaultBranch main
# Enable colorful output
git config --global color.ui auto- Go to GitHub's signup page
- Enter your username, email address, and password
- Verify your email address
- Optionally complete your profile with a picture and additional information
When pushing to GitHub for the first time, you'll be prompted to enter your GitHub username and password.
For increased security with HTTPS, it's recommended to use a personal access token instead of your password:
- Go to GitHub → Settings → Developer settings → Personal access tokens
- Click "Generate new token"
- Select the appropriate scopes (at minimum, select "repo")
- Generate the token and save it somewhere secure
-
Generate an SSH key pair:
ssh-keygen -t ed25519 -C "your.email@example.com" -
Start the SSH agent:
# For Windows eval "$(ssh-agent -s)" # For macOS/Linux eval "$(ssh-agent -s)"
-
Add your SSH key to the agent:
ssh-add ~/.ssh/id_ed25519 -
Copy your public key:
# For Windows cat ~/.ssh/id_ed25519.pub | clip # For macOS pbcopy < ~/.ssh/id_ed25519.pub # For Linux xclip -sel clip < ~/.ssh/id_ed25519.pub # or cat ~/.ssh/id_ed25519.pub # Then manually copy the output
-
Go to GitHub → Settings → SSH and GPG keys → New SSH key
-
Paste your public key and save
Now that you have Git installed and your GitHub account set up, you can proceed to learn about Basic Git Commands.