Checkout Jenkins Pipeline Git SCM with credentials?

后端 未结 6 1693
情深已故
情深已故 2020-12-04 08:20

I was following this tutorial:

node {
  git url: \'https://github.com/joe_user/simple-maven-project-with-tests.git\'
  ...
}

However it doe

6条回答
  •  [愿得一人]
    2020-12-04 09:02

    To explicitly checkout using a specific credentials

        stage('Checkout external proj') {
            steps {
                git branch: 'my_specific_branch',
                    credentialsId: 'my_cred_id',
                    url: 'ssh://git@test.com/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.

提交回复
热议问题