Git checkout is failing

Hi, I am new to Git and so don’t understand it well. I’m trying to perform a git checkout from with a declarative pipeline but it is failing. Here’s the pipeline snippet:

checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[credentialsId: '<snip>', url: '<snip>.git']]])

The checkout works from the command line (credentials entered manually).

The log is:

[Pipeline] checkout
The recommended git tool is: NONE
using credential <snip>
Cloning the remote Git repository
Cloning repository<snip>.git
 > git init /data/jenkins/workspace/github_test_1 # timeout=10
Fetching upstream changes from<snip>.git
 > git --version # timeout=10
 > git --version # 'git version 2.25.1'
using GIT_ASKPASS to set credentials <snip>
Setting http proxy: <snip>
 > git fetch --tags --force --progress --<snip>.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --<snip>.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stderr: remote: Invalid username or password.

Can you help me please?

Be sure that the referenced credential uses your GitHub user name and a personal access token that you have generated on GitHub with permission.

Be sure that the referenced credential is not an ssh private key credential. Sometimes a valid credential of the wrong type is used. The git plugin should do a better job of warning for that case, but if I remember correctly, it doesn’t warn very clearly.

@MarkEWaite Thanks for your reply. I will re-check the referenced credential but I think it is correct. We don’t use ssh with that credential - just a GitHub Personal Access Token.

The Snippet Generator offers this form:

git credentialsId: ‘’, url: ‘’

would I be better off using that in some way?

The git Pipeline task is a short form of the checkout task with fewer options and no plan to add any further options to it. If it fails with checkout, it will fail with git. If not, that is a very interesting bug and needs a bug report to the git plugin

@MarkEWaite My fault, I updated the credential and now it is working. However, it does report:

The recommended git tool is: NONE

Is that normal?

Thanks for your help.

Yes, that is normal. The git plugin had an enhancement added in Google Summer of Code 2020 to automatically choose the preferred git implementation based on the size of the git repository. When the plugin knows that a repository is less than 5 MB and the instance has JGit enabled, it will switch to use JGit rather than command line git. Likewise, when the plugin knows the size of the repository is more than 5 MB, it will use command line git.

JGit is faster than command line git for small repositrories. Command line git is faster than JGit for large repositories.

You can read more about it at

@MarkEWaite Thanks for your explanation :slightly_smiling_face: