Git
How to Check Git Version in CMD?
Git is an essential tool for version control and collaboration in software development. Knowing the version of Git installed on your system is important for compatibility with other tools, troubleshooting, and ensuring you’re using the latest features.
This blog walks you through checking the Git version using the Command Prompt (CMD) on Windows.
Why Check the Git Version?
- Verify Installation: Ensure Git is installed and configured on your system.
- Compatibility: Confirm the installed version supports specific features or integrations.
- Updates: Determine if you need to update to a newer version of Git.
Steps to Check Git Version in CMD
1. Open Command Prompt
- Press
Win + R
to open the Run dialog box. - Type
cmd
and press Enter to open the Command Prompt.
2. Check Git Installation
Type the following command to verify if Git is installed:
git
If Git is installed, you’ll see a list of commands and options. If not, you may see an error like 'git' is not recognized as an internal or external command
.
3. Check Git Version
To check the version of Git installed, enter the following command:
git --version
Example Output:
git version 2.41.0.windows.1
This output confirms that Git is installed and provides the exact version number (e.g., 2.41.0
in this case).
What to Do If Git Is Not Installed
If the git
command is not recognized, Git may not be installed or added to your system’s PATH environment variable.
Install Git
- Download Git from the official website: git-scm.com.
- Run the installer and follow the on-screen instructions.
- Restart your Command Prompt after installation.
Add Git to PATH
If Git is installed but not recognized:
- Open the Start Menu and search for Environment Variables.
- Click Edit the system environment variables.
- In the System Properties window, click Environment Variables.
- Under System Variables, select
Path
and click Edit. - Add the path to Git’s
bin
andcmd
directories (e.g.,C:\Program Files\Git\bin
). - Click OK and restart CMD.
Best Practices
- Keep Git Updated: Always use the latest stable version of Git to benefit from new features and security updates.
- Test After Installation: After installing or updating Git, use
git --version
to confirm the installation was successful. - Learn Git Commands: Familiarize yourself with essential Git commands to boost productivity.
Conclusion
Checking the Git version using CMD is a simple but important task for ensuring your development environment is set up correctly.
By following this guide, you can easily verify your Git installation and stay updated with the latest features and improvements.