I am running it for Linux. So is that command correct ?
No, the command should be git ...
, not @git
.
You have more advanced sh(script:(...)
examples in "Run bash command on jenkins pipeline", and none of them have a @
in them.
sh label: 'Run fancy bash script',
script: '''
#!/usr/bin/env bash
echo "Hello ${SHELL}!"
'''.stripIndent().stripLeading()
Or, as in "How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?":
try {
// Fails with non-zero exit if dir1 does not exist
def dir1 = sh(script:'ls -la dir1', returnStdout:true).trim()
} catch (Exception ex) {
println("Unable to read dir1: ${ex}")
}