I am trying to get the tagged commit hash. From terminal command is working fine:
But when I am running the same command from sh script like this:
tagged_commit = sh(returnStdout: true, script: """
git rev-list -1 v1
""")
It is showing me this error.
I have tried all the commands listed here on this link: How to tell which commit a tag points to in Git?
For all these commands it's showing the same error.
Note: I am trying to use this from groovy.