I am trying to checkout my code base using jenkins pipeline. To do that i need 'credentialsId' for authentication purpose.
stage('Checkout my codebase') {
steps {
dir('terraform_src') {
git(
branch: "${GIT_BRANCH}",
credentialsId: "${GIT_CREDENTIALS}",
url: "git@bitbucket.org:org_name/project_name.git",
)
}
}
}
How can i generate or where can i get the value for 'credentialsId' string?
Currently in my local machine i am using user name and password for authentication purposes for pull and push.
How to create 'credentialsId' using my user name and password?
Login to your jenkins machine.
In 'System' section, click Global credentials (unrestricted) .
In the next screen, you will see 2 options in the sidebar,
Got some inputs from the StackOverflow answer and corresponding comments.