Error running git“Cannot run program ”git”: error=2

This question already has an answer here:

  • Android Studio Checkout Github Error “CreateProcess=2” (Windows)

    2 answers

  • Build gradle in jenkins failed to find Build Tools revision 21.1.1
  • Git & Android studio : Change the details of submitted change list
  • How to import an existing project from github into Android Studio
  • repo sync fails with “error: index-pack died of signal 9”
  • What's a good, free source control system for eclipse android development?
  • push error: master: master
  • Cloning from Github to a specific directory results in an empty directory. Where are the files?
  • how to set up git repos and branches for contributing to 3rd party projects?
  • How can I get the git repo on my server to automatically sync with changes to the github repo?
  • Pull Requests for orphan branch
  • How can I upload my application to github but remove sensitive authorization information?
  • Deploying a React Webpack app (not created with create-react-app) to Github pages
  • 3 Solutions collect form web for “Error running git“Cannot run program ”git”: error=2”

    Check the path registered in Settings -> Version Control -> Git, in text box next to “Path to Git Executable“.

    It should reference a local installation of git.
    If the path mentioned there doesn’t exist, that would explain the error message.

    Use your terminal and check the following.

    1) Check if you have installed git

    git --version

    You should see something like

    git version

    If not, there could be an error in Git installation

    2) See if a .git file exists in the directory you want to push to the remote repo.

    cd <into your directory>
    ls -altr

    You should see a file with the name .git.

    This is the file that git will use to track the repo details.

    Within terminal you can find your git install directory with:

    git --exec-path
    Git Baby is a git and github fan, let's start git clone.