Skip to content

Commit

Permalink
Add clearer credentialsId to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Revial authored Jul 17, 2017
1 parent 0826fdf commit a48bdc4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pipeline-examples/push-git-repo/pushGitRepo.Groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

// credentialsId here is the credentials you have set up in Jenkins for pushing
// to that repository using username and password.
withCredentials([usernamePassword(credentialsId: 'MyID', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
withCredentials([usernamePassword(credentialsId: 'git-pass-credentials-ID', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh("git tag -a some_tag -m 'Jenkins'")
sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@<REPO> --tags')
}

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

0 comments on commit a48bdc4

Please sign in to comment.