Installing Git on Windows
Let's install Git on Windows step by step.
Download Git for Windows
- Go to git-scm.com/download/win
- The download should start automatically
- If not, click the download link
Run the Installer
- Run the downloaded
.exefile - Accept the license agreement
- Choose installation options (defaults are fine for most users)
Key Installation Options
Select Components
- ✅ Git Bash Here
- ✅ Git GUI Here
- ✅ Associate .git* configuration files with the default text editor
Default Editor
Choose your preferred editor:
- VS Code (recommended)
- Notepad++
- Vim
PATH Environment
Select: Git from the command line and also from 3rd-party software
This allows you to use Git in Command Prompt, PowerShell, and Git Bash.
Line Ending Conversions
Select: Checkout Windows-style, commit Unix-style line endings
This is the recommended option for Windows users.
Verify Installation
Open a new terminal (Command Prompt, PowerShell, or Git Bash):
1git --version
2# Output: git version 2.43.0.windows.1Configure Git
Set your identity:
1# Set your name
2git config --global user.name "Your Name"
3
4# Set your email
5git config --global user.email "your.email@example.com"Verify Configuration
1git config --listGit Bash vs Command Prompt
Git Bash
Git Bash provides a Unix-like terminal experience on Windows:
1# Unix commands work in Git Bash
2ls -la
3pwd
4mkdir new-folderCommand Prompt / PowerShell
Standard Windows terminals also work with Git:
1# Windows commands
2dir
3cd
4mkdir new-folderRecommendation: Use Git Bash for a consistent experience with tutorials and documentation.
Set Default Editor
1# For VS Code
2git config --global core.editor "code --wait"
3
4# For Notepad++
5git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"Set Default Branch Name
1git config --global init.defaultBranch mainTest Your Installation
1# Create a test folder
2mkdir git-test
3cd git-test
4
5# Initialize a repository
6git init
7
8# Create a test file
9echo "Hello Git" > test.txt
10
11# Stage and commit
12git add test.txt
13git commit -m "Initial commit"
14
15# Success!Windows Credential Manager
Git for Windows includes a credential manager that securely stores your GitHub credentials:
1# Check credential helper
2git config --global credential.helper
3
4# Should output: manager-core (or manager)Troubleshooting
'git' is not recognized
If Command Prompt doesn't recognize git:
- Close and reopen Command Prompt
- Verify PATH includes Git:
echo %PATH% - Reinstall Git and ensure "Add to PATH" is selected
Line Ending Issues
If you see warnings about line endings:
1git config --global core.autocrlf trueSSL Certificate Issues
If you encounter SSL errors:
1git config --global http.sslVerify trueSummary
You've installed Git on Windows! Remember:
- Git Bash provides a Unix-like experience
- Command Prompt works too
- Configure your name and email
- Test with a sample repository
Next, let's install Git on Linux!
