0
0
Jenkinsdevops~10 mins

Git repository configuration in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to clone a Git repository using Jenkins pipeline.

Jenkins
git url: '[1]'
Drag options to blanks, or click blank then click option'
Assh://repo.git
Bgit clone https://github.com/example/repo.git
Crepo.git
Dhttps://github.com/example/repo.git
Attempts:
3 left
💡 Hint
Common Mistakes
Including the 'git clone' command inside the URL parameter
Using only the repository name without full URL
Using SSH URL without proper credentials
2fill in blank
medium

Complete the code to specify the branch to checkout in Jenkins Git step.

Jenkins
git url: 'https://github.com/example/repo.git', branch: '[1]'
Drag options to blanks, or click blank then click option'
Amain
Bfeature
Cdevelop
Dmaster
Attempts:
3 left
💡 Hint
Common Mistakes
Using branch names that do not exist in the repository
Leaving the branch parameter empty
Using 'master' when the repo uses 'main'
3fill in blank
hard

Fix the error in the Jenkins pipeline Git checkout step by completing the missing parameter.

Jenkins
checkout([$class: 'GitSCM', branches: [[name: '[1]']], userRemoteConfigs: [[url: 'https://github.com/example/repo.git']]])
Drag options to blanks, or click blank then click option'
Arefs/heads/main
Bmain
Crefs/tags/v1.0
DHEAD
Attempts:
3 left
💡 Hint
Common Mistakes
Using just 'main' instead of 'refs/heads/main'
Using tag refs when a branch is expected
Using 'HEAD' which is ambiguous
4fill in blank
hard

Fill both blanks to configure Git credentials and repository URL in Jenkins pipeline.

Jenkins
git url: '[1]', credentialsId: '[2]'
Drag options to blanks, or click blank then click option'
Ahttps://github.com/example/repo.git
Bgit-credentials-id-123
Cssh://github.com/example/repo.git
Duser-credentials-id
Attempts:
3 left
💡 Hint
Common Mistakes
Using SSH URL without matching credentials
Using wrong credentials ID
Mixing URL and credentials values
5fill in blank
hard

Fill all three blanks to create a Jenkins pipeline step that checks out a specific branch with credentials.

Jenkins
checkout([$class: 'GitSCM', branches: [[name: '[1]']], userRemoteConfigs: [[url: '[2]', credentialsId: '[3]']]])
Drag options to blanks, or click blank then click option'
Arefs/heads/develop
Bhttps://github.com/example/repo.git
Cgit-credentials-id-456
Drefs/tags/v2.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using tag refs instead of branch refs
Incorrect or missing credentials ID
Using incomplete branch names