Error looks like:
Failed to connect to repository : Command "git ls-remote -h HEAD" returned status code 128: stdout: stderr: remote: HTTP Basic: Access denied fatal: Authentication failed for
Error looks like:
Failed to connect to repository : Command "git ls-remote -h HEAD" returned status code 128: stdout: stderr: remote: HTTP Basic: Access denied fatal: Authentication failed for
You are using the wrong user name and password: 1. create an API token against your username in your gitlab 2. Add the AccessToken and username in your Jenkins credentials. instead of using the username and password.
Just try out the connection: log in to the Jenkins server and try to run the command 'git ls-remote -h url'
and provide user name and AccessToken which you have created in gitlab and configured in Jenkins.
It will provide an output if the username and API matches or else it will give an error as authentication failure...
And make sure your username has access to the repository
Go through LINK, which guides for how to create Global Credentials for Git API Token and for other users.
Create an Interpersonal User under Global Credential which you can then use in all Jenkins jobs.
Make sure that you add the SSH Private key (with Jenkins generate or of your choice's Credential Id), take a kind as 'SSH User with Private Key'
While creating Jenkins job in SCM > Git connection you can select credentials of Interpersonal User from Add dropdown.