To explicitly checkout using a specific credentials
stage('Checkout external proj') {
steps {
git branch: 'my_specific_branch',
credentialsId: 'my_cred_id',
url: 'ssh://[email protected]/proj/test_proj.git'
sh "ls -lat"
}
}
To checkout based on the configred credentials in the current Jenkins Job
stage('Checkout code') {
steps {
checkout scm
}
}
You can use both of the stages within a single Jenkins file.