Complete the code to clone a Git repository using Jenkins pipeline.
git url: '[1]'
The git step in Jenkins pipeline requires the repository URL as the url parameter to clone the repository.
Complete the code to specify the branch to checkout in Jenkins Git step.
git url: 'https://github.com/example/repo.git', branch: '[1]'
The branch parameter specifies which branch Jenkins should checkout. 'main' is the default branch name in many repositories.
Fix the error in the Jenkins pipeline Git checkout step by completing the missing parameter.
checkout([$class: 'GitSCM', branches: [[name: '[1]']], userRemoteConfigs: [[url: 'https://github.com/example/repo.git']]])
When using checkout with GitSCM, the branch name must be specified as a full ref, like refs/heads/main.
Fill both blanks to configure Git credentials and repository URL in Jenkins pipeline.
git url: '[1]', credentialsId: '[2]'
The url parameter specifies the Git repository URL, and credentialsId specifies the Jenkins stored credentials to access the repo.
Fill all three blanks to create a Jenkins pipeline step that checks out a specific branch with credentials.
checkout([$class: 'GitSCM', branches: [[name: '[1]']], userRemoteConfigs: [[url: '[2]', credentialsId: '[3]']]])
This checkout step specifies the branch as a full ref, the repository URL, and the credentials ID to authenticate.