Jenkins git checkout "Authentication failed" over HTTPS in CI
Git reached the HTTPS remote but the credentials were rejected. The username/password or token Jenkins supplied is missing, wrong, expired, or has no access to the repository, so the clone is denied.
What this error means
The checkout fails with remote: Invalid username or password (or token) and fatal: Authentication failed for 'https://git.example.com/org/repo.git/'.
Jenkins console
remote: Support for password authentication was removed.
fatal: Authentication failed for 'https://github.com/org/repo.git/'Common causes
Missing or wrong credentials binding
The job references no credential, or the wrong credential ID, so git sends no valid secret to the HTTPS remote.
An expired or unscoped token
A personal access token expired or lacks repo read scope; many hosts no longer accept account passwords, only tokens.
How to fix it
Attach a valid token credential
- Create a "Username with password" credential whose password is a valid PAT with repo read scope.
- Select that credential in the job's SCM / checkout step.
- Rotate the token if it expired and update the credential in one place.
Jenkinsfile
checkout scmGit(
userRemoteConfigs: [[url: 'https://github.com/org/repo.git',
credentialsId: 'github-pat']],
branches: [[name: '*/main']])How to prevent it
- Use token-based credentials; many hosts reject passwords.
- Track token expiry and rotate before it lapses.
- Grant least-privilege repo read scope to CI tokens.
Related guides
Jenkins git "Host key verification failed" (SSH checkout) in CIFix Jenkins git checkout "Host key verification failed. fatal: Could not read from remote repository" - the a…
Jenkins git "Couldn't find any revision to build" in CIFix Jenkins "ERROR: Couldn't find any revision to build. Verify the repository and branch configuration" - th…
Jenkins multibranch "Jenkinsfile not found" / no Jenkinsfile in CIFix Jenkins multibranch / pipeline-from-SCM "ERROR: ... Jenkinsfile not found" - the configured script path d…