I am attempting to import a project from github into intellij and am running into this stack trace:
Caused by:
java.io.IOException: Cannot run program "git": error=2, No such file or directory at common_c6b3s0xd8gl4x9r47zsnga1nq$_run_closure12.doCall(/Users/jrengh/Documents/teri/common.gradle:97)
I have seen this issue posted around the internet a lot and the common solution seems to be to make sure that the git executable is correctly listed in the "Path to git executable" field under Settings > Version control > Git. I have done so, tested the connection and have gotten a successful message.
The issue stems from this task method called in a separate gradle file located within one of my project's dependencies:
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()
}
So essentially, intellij doesn't recognize the "git" in the command I try to execute above even though I have successfully uploaded a git executable. Does anyone have any helpful suggestions?
I have just installed a fresh Ubuntu Gnome 15.10 and Git was not installed.
On Ubuntu to install Git:
sudo apt-get install git
Intellij Idea can of course not execute a command it does not find.
So as it turned out, if I used the full directory location ('/usr/local/git/bin/git' in my case) instead of simply 'git' in those command executions, then the problem was solved. So for example, the first line of the method had to read "def proc = /usr/local/git/bin/git rev-parse --short HEAD".
If I were attempting to edit this code in a team setting (such as pushing it back into github for the other members of my team to see), then I would need to alias this directory location so that "git" could remain in the code and still work on my machine; however since I do not plan on pushing this back into github, this is all I need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With