
Table of Contents
- Error Description
- 5 Things That Can Go Wrong
- 5 Ways to Fix
- Installing Git on Ubuntu
- Installing Git on macOS
- Check Git Installation
Error Description
You will get git: command not found error on the zsh shell if you do not have git installed on your computer.
5 Things That Can Go Wrong
- Git is not installed on your system.
- Check if Git is installed by running
git --versionin the terminal. If it returns a version number, Git is installed.
- Check if Git is installed by running
- Git is not added to your system's PATH.
- Check if Git is in your PATH by running
echo $PATHin the terminal and looking for the directory containing Git.
- Check if Git is in your PATH by running
- There are typos in your command.
- Double-check your command for any spelling mistakes or incorrect options.
- There are issues with your package manager.
- Check your package manager's configuration and logs for any errors or issues.
- There are permission issues preventing installation.
- Ensure you have the necessary permissions to install software. You may need to use
sudofor administrative privileges.
- Ensure you have the necessary permissions to install software. You may need to use
5 Ways to Fix
- Install Git using a package manager:
- For Ubuntu:
sudo apt-get install git - For macOS:
brew install git
- For Ubuntu:
- Ensure Git is added to your system's PATH:
- Check if Git is in your PATH by running
echo $PATHin the terminal and looking for the directory containing Git. - If Git is not in your PATH, add it by editing your shell configuration file (e.g.,
.bashrc,.zshrc) and adding the line:export PATH=$PATH:/path/to/git
- Check if Git is in your PATH by running
- Restart your terminal or computer after installation:
- Close and reopen your terminal, or restart your computer to apply the changes.
- Check for typos in your command:
- Double-check your command for any spelling mistakes or incorrect options. For example, ensure you type
gitinstead ofgti.
- Double-check your command for any spelling mistakes or incorrect options. For example, ensure you type
- Reinstall Git if the problem persists:
- For Ubuntu:
sudo apt-get remove gitfollowed bysudo apt-get install git - For macOS:
brew uninstall gitfollowed bybrew install git
- For Ubuntu:
Installing Git on Ubuntu
- Open Terminal,
- Type command
sudo apt-get install git
Installing Git on macOS
Type command brew install git in Terminal.
Check Git Installation
To check if Git is installed, use the command git --version.

Conclusion
By following the steps outlined in this guide, you should be able to resolve the git: command not found error and successfully install and configure Git on your system.
Remember to check for common issues such as installation errors, PATH configuration, and typos in your commands. With Git properly set up, you can now take full advantage of its powerful version control capabilities.
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!