Skip to content

Commit 0826fdf

Browse files
author
Olivier Revial
authored
Add ssh-agent usage example
Just added a small example of ssh-agent usage for Git push
1 parent d4440da commit 0826fdf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pipeline-examples/push-git-repo/pushGitRepo.Groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ withCredentials([usernamePassword(credentialsId: 'MyID', passwordVariable: 'GIT_
1111
}
1212

1313
// For SSH private key authentication, try the sshagent step from the SSH Agent plugin.
14+
sshagent (credentials: ['git-credentials']) {
15+
sh("git tag -a some_tag -m 'Jenkins'")
16+
sh('git push <REPO> --tags')
17+
}

0 commit comments

Comments
 (0)