Intellij import problem - java.io.IOException: the git program cannot start: error = 2, there is no such file or directory

I am trying to import a project from github into intellij and run into this stack trace:

Caused by:

java.io.IOException: cannot start the program "git": error = 2, there is no such file or the directory in common_c6b3s0xd8gl4x9r47zsnga1nq $ _run_closure12.doCall (/Users/jrengh/Documents/teri/common.gradle:97)

I often saw this problem on the Internet, and the general solution seems to be to make sure that the git executable is correctly specified in the "Path to git executable" field under "Settings"> "Version Control"> Git. I did this, checked the connection and received a successful message.

The problem is with this task method, which is called in a separate gradle file located in one of my dependencies between projects:

common.gradle

task buildInfo { def cmd = "git rev-parse --short HEAD" def proc = cmd.execute() project.ext.revision = proc.text.trim() cmd = "git show -s --format=%ct HEAD" proc = cmd.execute() project.ext.timestamp = proc.text.trim() } 

Thus, intellij does not recognize "git" in the command that I am trying to execute above, although I have successfully downloaded the git executable. Does anyone have any helpful suggestions?

+7
git intellij-idea gradle
source share
2 answers

So, as it turned out, if I were to use the full directory location ('/ usr / local / git / bin / git' in my case) instead of the simple 'git' in these command executions, then the problem was solved. For example, the first line of the method should read "def proc = / usr / local / git / bin / git rev-parse --short HEAD".

If I tried to edit this code in the command setup (for example, to return it to github for other members of my team to see), then I would need an alias for this directory location so that "git" can remain in the code and work on my a car; however, since I do not plan to push this back to github, that’s all I need.

+1
source share

I just installed the new Ubuntu Gnome 15.10 and Git has not been installed.

On Ubuntu to install Git:

 sudo apt-get install git 

Intellij Idea may, of course, not execute a command that it does not find.

+6
source share

All Articles