Set Up and Configure Git on Windows
Git is a distributed version control system. This guide covers installing Git Bash on Windows and configuring your identity for the first time.
Prerequisites
- Windows PC with internet access
Steps
# Download Git for Windows from:
# https://git-scm.com/download/win
# Install and launch Git Bash from the Start menu
# Create a project directory and initialize a repo
mkdir my-project
cd my-project
git init
# Configure your identity (required before first commit)
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
# Check repo status
git status
# Stage and commit files
git add .
git commit -m "Initial commit"
Verify
git log --oneline
Notes
- Set
--globalto apply the identity to all repos on the machine, or omit it to set per-repo. - Use
git config --listto view all current settings. - For SSH key setup:
ssh-keygen -t ed25519 -C "you@example.com"then add the public key to GitHub/GitLab.