0
0
Jenkinsdevops~20 mins

Git plugin configuration in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Plugin Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Git plugin: What is the output of this Jenkins pipeline snippet?
Consider this Jenkins pipeline snippet using the Git plugin to clone a repository. What will be the output in the Jenkins console after running this?
Jenkins
pipeline {
  agent any
  stages {
    stage('Clone') {
      steps {
        git url: 'https://github.com/example/repo.git', branch: 'main'
      }
    }
  }
}
ACloning into 'repo'...\nChecking out Revision main (refs/heads/main)\nFinished: SUCCESS
BCloning into 'repo'...\nfatal: remote origin already exists.\nFinished: FAILURE
CERROR: Repository not found.\nFinished: FAILURE
DCloning into 'repo'...\nChecking out Revision develop (refs/heads/develop)\nFinished: SUCCESS
Attempts:
2 left
💡 Hint
The branch specified is 'main', so the checkout will be for 'main'.
Configuration
intermediate
2:00remaining
Git plugin: Which configuration snippet correctly sets credentials for private repo access?
You want Jenkins to clone a private Git repository using stored credentials. Which configuration snippet correctly sets the credentials ID in the Git plugin step?
Agit url: 'https://github.com/private/repo.git', credentialsId: 'my-creds-id'
Bgit url: 'https://github.com/private/repo.git', credentialId: 'my-creds-id'
Cgit url: 'https://github.com/private/repo.git', credentials: 'my-creds-id'
Dgit url: 'https://github.com/private/repo.git', credId: 'my-creds-id'
Attempts:
2 left
💡 Hint
The Git plugin expects the exact parameter name for credentials.
Troubleshoot
advanced
2:00remaining
Git plugin: Why does this Jenkins job fail with 'Could not resolve host' error?
A Jenkins job using the Git plugin fails with this error: 'fatal: unable to access 'https://github.com/example/repo.git/': Could not resolve host: github.com'. What is the most likely cause?
AThe repository URL is misspelled in the job configuration
BJenkins server has no internet or DNS access to github.com
CThe Git plugin is not installed in Jenkins
DThe credentials ID is invalid or missing
Attempts:
2 left
💡 Hint
The error indicates a network or DNS problem.
🔀 Workflow
advanced
2:00remaining
Git plugin: What is the correct order of steps to configure a Jenkins job to poll Git changes?
Arrange these steps in the correct order to configure a Jenkins freestyle job to poll a Git repository for changes.
A1,2,3,4
B3,1,2,4
C1,3,2,4
D3,2,1,4
Attempts:
2 left
💡 Hint
You must first define the repo and credentials before enabling polling.
Best Practice
expert
2:00remaining
Git plugin: Which practice ensures secure and maintainable Jenkins Git configurations?
Which of the following is the best practice when configuring Git plugin in Jenkins for multiple jobs accessing private repositories?
ACreate separate credentials for each job with the same username and password
BHardcode username and password in each job's Git URL
CUse anonymous access for all repositories to avoid credential management
DStore credentials centrally in Jenkins Credentials and reference by ID in jobs
Attempts:
2 left
💡 Hint
Centralized credential management improves security and ease of updates.