Which type of Jenkins credential is best suited for accessing a private Git repository using SSH keys?
Think about what is commonly used for secure Git access over SSH.
SSH Username with private key is the recommended credential type for Git access over SSH in Jenkins. It uses a private key for authentication without exposing passwords.
What will be the output of the Jenkins pipeline step when using a Git credential with ID 'git-creds' to clone a private repository?
pipeline {
agent any
stages {
stage('Clone') {
steps {
git url: 'git@github.com:example/private-repo.git', credentialsId: 'git-creds'
}
}
}
}Jenkins uses the credentialsId to authenticate automatically.
When the correct credentialsId is provided, Jenkins uses it to authenticate and clone the private Git repository without manual input.
Which Jenkins credential configuration is correct for accessing a private Git repository over HTTPS that requires a username and personal access token?
HTTPS Git access usually requires username and token as password.
For HTTPS Git access, Jenkins credentials should be set as 'Username with password', where the password is the personal access token from the Git provider.
Jenkins fails to clone a private Git repository with the error: 'Authentication failed'. The pipeline uses a credentialsId for SSH access. What is the most likely cause?
Check the private key validity in Jenkins credentials.
If the private key is missing or invalid, SSH authentication will fail causing the error.
Which Jenkins pipeline snippet securely uses Git credentials stored in Jenkins to clone a private repository and avoids exposing credentials in logs?
Consider Jenkins built-in Git step and credential masking.
Using the Jenkins 'git' step with credentialsId automatically masks credentials and avoids exposing them in logs, unlike manual shell commands.