How to Install and Set Up Git on Windows

Git is essential for every developer. Learn to install Git on Windows, configure your identity, create your first repository, and push code to GitHub step by step.

How to Install and Set Up Git on Windows

Git tracks every change you make to your code, lets you collaborate with others on the same project, and lets you roll back to any previous version instantly. It is used by every professional software team in the world. Here is how to get it running on Windows.

Step 1: Download Git for Windows

1

Download the installer

Go to git-scm.com/download/win. The download starts automatically.

2

Run the installer

Keep most defaults. Important settings to choose:

Step 2: Configure Your Git Identity

This is required — Git uses this information to sign every commit you make. Open Git Bash (search in Start Menu):

git config --global user.name "Your Full Name"
git config --global user.email "your@email.com"
# Verify your settings
git config –list

Step 3: Verify the Installation

git --version
# Expected output: git version 2.45.0.windows.1

Step 4: Create Your First Repository

# Create a new folder for your project
mkdir my-project
cd my-project
# Initialize Git in the folder
git init

# Create a README file
echo “# My Project” > README.md

# Stage all files
git add .

# Make your first commit
git commit -m “Initial commit”

Step 5: Push to GitHub

After creating an account on GitHub and creating a new empty repository there:

# Connect your local repository to GitHub
git remote add origin https://github.com/yourusername/your-repo.git
# Push your code (the -u flag sets the upstream tracking)
git push -u origin main

Essential Git Commands Reference

VS Code Integration

VS Code has excellent built-in Git support. Press Ctrl + Shift + G to open the Source Control panel where you can stage, commit, and push without ever typing a command.

🔧

zSmartFix Editorial Team

Step-by-step technical guides tested on real hardware. Our guides are independently written and freely accessible to everyone.

Leave a Reply

Your email address will not be published. Required fields are marked *