Git cloning from private Gitlab repo stopped working for Free-style jobs

623 views
Skip to first unread message

Vadim Kotov

unread,
Jun 27, 2018, 9:37:17 AM6/27/18
to Jenkins Users
Hi,

My freestyle jobs with git repo (Gitlab) cloning stopped working, it says "returned status code 128: fatal: Authentication failed". I did not change the credentials, and pipeline jobs using these credentials are still working. I've created new credentials that are 100% correct, but the result is the same. What can I do to fix this? Any debug steps to consider to know what's going on?
I'm using login/password pair as credentials btw.

Here is the log:

Building on master in workspace [redacted]
 
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 
> git config remote.origin.url https://gitlab.com/[redacted].git # timeout=10
Fetching upstream changes from https://gitlab.com/[redacted].git
 
> git --version # timeout=10
using GIT_ASKPASS to set credentials vkotovv gitlab credentials
 
> git fetch --tags --progress https://gitlab.com/[redacted].git +refs/heads/*:refs/remotes/origin/*
ERROR
: Error fetching remote repo 'origin'
hudson
.plugins.git.GitException: Failed to fetch from https://gitlab.com/[redacted].git
    at hudson
.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
    at hudson
.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
    at hudson
.plugins.git.GitSCM.checkout(GitSCM.java:1186)
    at hudson
.scm.SCM.checkout(SCM.java:504)
    at hudson
.model.AbstractProject.checkout(AbstractProject.java:1208)
    at hudson
.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
    at jenkins
.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson
.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
    at hudson
.model.Run.execute(Run.java:1794)
    at hudson
.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson
.model.ResourceController.execute(ResourceController.java:97)
    at hudson
.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://gitlab.com/[redacted].git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout
:
stderr
: fatal: Authentication failed for 'https://gitlab.com/[redacted].git/'

    at org
.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2002)
    at org
.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1721)
    at org
.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
    at org
.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:405)
    at hudson
.plugins.git.GitSCM.fetchFrom(GitSCM.java:886)
   
... 11 more
ERROR
: Error fetching remote repo 'origin'
Finished: FAILURE

Thanks,
Vadim

Vadim Kotov

unread,
Jun 27, 2018, 10:00:00 AM6/27/18
to Jenkins Users
Nerermind, I've found a fix.

This was related to Jenkins Git plugin.
As stated here:
Don't setup a credential helper, or if one is defined, delete that section from the ~/.gitconfig file. It can cause weird authentication issues.
Turns out one person from my team set his git credentials on the build server, there were some sections in ~/.gitconfig and ~/.git-credentials files. After deleting this it now works again.
Reply all
Reply to author
Forward
0 new messages