How to Install Git on Windows: Step-by-Step Guide
To install
Git on Windows, download the official installer from git-scm.com, run the installer, and follow the setup prompts. After installation, verify by opening Command Prompt and typing git --version.Syntax
The installation process involves downloading the Git installer executable and running it with default or customized options.
Key steps include:
- Downloading the installer from the official site
- Running the installer executable
- Choosing setup options like editor, PATH environment, and line ending conversions
- Completing the installation
plaintext
https://git-scm.com/download/winExample
This example shows how to download and verify Git installation on Windows using Command Prompt.
plaintext
1. Open your web browser and go to https://git-scm.com/download/win 2. Download the latest Windows Git installer. 3. Run the downloaded .exe file and follow the setup wizard. 4. After installation, open Command Prompt and type: git --version
Output
git version 2.42.0.windows.1
Common Pitfalls
Common mistakes when installing Git on Windows include:
- Not adding Git to the system PATH, which makes
gitcommand unavailable in Command Prompt. - Choosing incorrect line ending conversions, causing issues when collaborating across different operating systems.
- Skipping the installation of Git Bash, which provides a useful terminal for Git commands.
Always review setup options carefully during installation.
plaintext
REM Wrong: Not adding Git to PATH REM This causes 'git' command not found error REM Right: Select 'Git from the command line and also from 3rd-party software' option during setup
Quick Reference
Summary tips for installing Git on Windows:
- Download from the official site:
https://git-scm.com/download/win - Run the installer and select recommended options
- Ensure Git is added to your PATH environment variable
- Use Git Bash for a better command line experience
- Verify installation with
git --version
Key Takeaways
Download Git installer from the official website to ensure safety and latest version.
Run the installer and select the option to add Git to your system PATH.
Use Git Bash for a Unix-like terminal experience on Windows.
Verify installation by running 'git --version' in Command Prompt or Git Bash.
Choose line ending options carefully to avoid cross-platform issues.