Git error 401 while accessing it via hudson's

2019-02-18 12:29发布

问题:

I have hudson configured on my server and i am using code fetched from my git repository. Actually , i had set up the environment correctly and all the builds via Hudson were successful but recently i changed my git password from github.com and now all the builds fail giving a 401 error , I know its due to password change . Can anyone tell me how to change the password in Hudson via the git plugin so that the authentication passes. Here is the error I am getting

ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
ERROR:  (Underlying report) : Error performing command: /usr/bin/git fetch -t 
https://github.com/xxx/xxx +refs/heads/*:refs/remotes/origin/*

Command "/usr/bin/git fetch -t https://github.com/xxx/xxx +refs/heads/*:refs

/remotes/origin/*" returned status code 128: error: The requested URL returned error: 401 

while accessing https://github.com/xxx/xxx/info/refs

fatal: HTTP request failed

ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository

Any ideas ??

回答1:

In the GitHub setup, it is mentioned:

Some tools connect to GitHub without SSH. To use these tools properly you need to find and configure your API Token.

$ git config --global github.user username
$ git config --global github.token 0123456789yourf0123456789token

Note If you ever change your GitHub password, a new token will be created and will need to be updated.

Even though your ssh authentications should be unchanged, make sure the global git config used by the Hudson user has some github settings updated.


After 90 minutes of discussion, it turned out that the other file that can be impacted by a password change is your .netrc file.
See "git clone over https 401 error and not asking for username or password"