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

  • Android Studio not checking Java files into GitHub
  • How to enable Version Control window in android studio
  • Robotium and Jenkins UI testing errors
  • Android Studio Commit&Push bug
  • How to use git branch with Android Studio
  • Android Studio, Git and three ways merge
  • Github Desktop doesn't display commits from merge --no-ff
  • Unknown SSL protocol error when cloning git repository from Gitblit
  • SSH Agent Forwarding not working
  • How to push to a new branch in Git carefully
  • Best way to share Github pull request templates between projects?
  • Git pulling a branch from another repository?
  • 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.