0
0
Jenkinsdevops~5 mins

Credentials for Git access in Jenkins - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of storing credentials in Jenkins for Git access?
Jenkins stores credentials securely to allow automated access to Git repositories without exposing passwords or tokens in job configurations.
Click to reveal answer
beginner
Name two types of credentials Jenkins supports for Git access.
Jenkins supports Username with password and SSH private key credentials for Git access.
Click to reveal answer
beginner
How do you add Git credentials in Jenkins?
Go to Jenkins dashboard → Manage Jenkins → Manage Credentials → Select domain → Add Credentials → Choose type (e.g., SSH Username with private key) → Fill details → Save.
Click to reveal answer
intermediate
What is the benefit of using SSH keys over username/password for Git access in Jenkins?
SSH keys provide stronger security and avoid storing plain passwords. They also allow password-less authentication once set up.
Click to reveal answer
intermediate
How does Jenkins use stored Git credentials in a pipeline script?
In a pipeline, you use the 'credentialsId' to reference stored credentials when checking out code, for example: checkout([$class: 'GitSCM', userRemoteConfigs: [[url: 'repo_url', credentialsId: 'my-cred-id']]]).
Click to reveal answer
Which Jenkins menu lets you add Git credentials?
AManage Jenkins → Manage Credentials
BNew Item
CBuild History
DConfigure System
What type of credential is recommended for secure Git access in Jenkins?
ASSH private key
BUsername only
CAPI key in job description
DPlain text password
In a Jenkins pipeline, how do you specify which credentials to use for Git checkout?
ABy setting environment variables
BBy hardcoding username and password
CUsing credentialsId in checkout step
DBy adding credentials to the workspace
What happens if you do not configure Git credentials in Jenkins for a private repo?
AJenkins uses anonymous access automatically
BJenkins can still clone the repo
CJenkins will prompt for credentials during build
DThe build will fail due to authentication error
Which credential type allows Jenkins to authenticate with GitHub using a personal access token?
ASSH Username with private key
BSecret text
CUsername with password
DCertificate
Explain how to securely add and use Git credentials in Jenkins for a private repository.
Think about Jenkins menus and pipeline usage.
You got /4 concepts.
    Describe the advantages of using SSH keys over passwords for Git access in Jenkins.
    Consider security and automation benefits.
    You got /4 concepts.