I'm trying to update bare git repo as part of build. On Linux it was relatively simple:
dir("/my/git/repo.git") {
sshagent(['git']) {
sh "git fetch origin module:module"
}
}
However I cannot figure out how to do it on Windows. I tried:
dir("c:\\my\\git\\repo.git") {
withEnv(["PATH=${env.PATH};C:\\Program Files\\Git\\usr\\bin"]) {
sshagent(['git']) {
sh "git fetch origin module:module"
}
}
}
But it fails:
Could not find ssh-agent: IOException: Cannot run program "ssh-agent": CreateProcess error=2, The system cannot find the file specified
Check if ssh-agent is installed and in PATH
How can I do it?