// troubleshooting guide · jenkins

Jenkins Git 'Failed to Connect to Repository' Status Code 128

Status
Workaround available
platforms:
Jenkins (Git plugin), all OS
updated:
November 16, 2026
reports:
4
Method
how we research
Share

RUNBOOK · jenkins/git-status-code-1284 FIXES

// quick answer

Status 128 is git's generic failure: read the stderr line under it. Usually the job has no or wrong credentials, a token was rejected, or the jenkins user's SSH host key/known_hosts is missing.

Most likely fix: Select or fix credentials

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Select or fix credentials

    1. 01Job > Configure > Source Code Management > Credentials
    2. 02For HTTPS use Username with password where the password is a personal access token
    3. 03For SSH use SSH Username with private key and a git@ URL
    Did this fix it?
  2. FIX 2Fix SSH host key verification

    1. 01Go to Manage Jenkins > Security > Git Host Key Verification Configuration
    2. 02Choose Accept first connection or Known hosts file, or as the jenkins user run ssh -T git@github.com once to add the host
    Did this fix it?
  3. FIX 3Test as the jenkins user

    1. 01Run sudo -u jenkins git ls-remote <repo URL> on the controller or agent
    2. 02Fix whatever error appears there (auth, network, proxy) before retrying in Jenkins
    Did this fix it?
  4. FIX 4Install or update git

    1. 01Check git --version on the node running the job
    2. 02Install a current git and set its path in Manage Jenkins > Tools > Git installations
    Did this fix it?

SANDBOX · jenkins RUNS IN YOUR BROWSER

Try it: push, review, run CI and merge in a code host and cloud workspace

A hands-on Jenkins-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.

Symptoms

Job configuration shows 'Failed to connect to repository: Command "git ls-remote -h ... HEAD" returned status code 128', or builds fail with hudson.plugins.git.GitException ... returned status code 128.

Why it happens

  • C-01No credential selected in the job's Source Code Management section
  • C-02Password used instead of a personal access token, or the token expired
  • C-03SSH key not authorized (Permission denied (publickey))
  • C-04Host key verification failed because the host isn't in known_hosts
  • C-05Git missing or too old on the controller/agent

// this guide also covers

  • jenkins failed to connect to repository
  • returned status code 128 jenkins
  • jenkins git permission denied publickey
  • jenkins host key verification failed

Still not working?

If Jenkins keeps failing, you're not alone. See every Jenkins problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch Jenkins Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other Jenkins errors

All 14 Jenkins errors and fixes →