Reputation: 6526
I am trying to execute git command in my build.gradle
file as shown below
println '===============>'
if (!branch){
// For local build
def proc = "git rev-parse --abbrev-ref HEAD".execute()
proc.in.eachLine {line -> println "===>$line"}
proc.err.eachLine {line -> println '===>ERROR: ' + line}
proc.waitFor()
}
println '<==============='
On execution it gives the below error:
===============>
===>ERROR: fatal: not a git repository (or any of the parent direc[![enter image description here][1]][1]tories): .git
<===============
When I tried to check the files/folders via ls -a
I can see the .git
folder
Upvotes: 1
Views: 1039
Reputation: 275
I am not sure if that will help you, but I had the same problem.
My case was that my build.gradle
was taking the wrong directory to execute.
At some of the file, I had the definition of the workingDir, I just had to change it:
- workingDir: File = File("."),
+ workingDir: File = projectDir,
I could figure the error was related to distributions of JDK to ARM64 architecture. You could also try to fix the error by changing to a distribution of JDK to x86.
Upvotes: 1