‘git’ is not recognized as an internal or external

Today in this article, we will cover below aspects,

Issue Description

git command line/CLI command gives below error,

‘git’ is not recognized as an internal or external command, operable program or batch file.

This issue I found to be due to not setting up the proper environment variable on a machine where you already have installed the GIT component.

You might get the GIT component installed on your computer either using an external download or using IDE tools with Visual studio or VS code or other IDE.

Please note that this behavior could occur differently if you are using other vendors services leveraging GIT exe (which is an open-source utility) like GitHub lab or BitBucket while installing such services are you were your desktop applications.

Resolution

On a Windows machine, you need to set up a GIT-related environment variable.

Please follow below high-level steps required for you to fix the issue.

  • Install GIT CLI utility, if not done so already .

  • Check the file path for GIT installtion

Usually, GIT exe will be available in the below location,

C:\Program Files\Git\bin

Or

C:\Program Files\Git\cmd
'git' is not recognized as an internal or external command, operable program or batch file.

  • Update System environment variable for any of the above paths,
git is not recognized as an internal

Note: To make the variable effective, Please close any existing CMD or Bash shell window.

Alternatively,

If you are using GitHub tools like desktop or services then you may find the GIT exe below location.

Below is an Approximate path only,

C:\Users\<your name>\AppData\Local\GitHub\PortableGit_<id>/cmd 

You can set a similar above path as an environment variable to fix the issue.

References :

Did I miss anything else in these resolution steps?

Did the above steps resolve your issue? Please sound off your comments below!

Happy Coding !!



Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



Leave a Reply

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