小编典典

通过Hudson的git插件访问它时出现Git错误401

jenkins

我在服务器上配置了hudson,我正在使用从git存储库中获取的代码。实际上,我已经正确设置了环境,并且通过Hudson进行的所有构建均成功,但是最近我从github.com更改了我的git密码,现在所有构建均失败,并出现401错误,我知道这是由于密码更改引起的。谁能告诉我如何通过git插件更改Hudson中的密码,以使身份验证通过。这是我得到的错误

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

有任何想法吗 ??


阅读 403

收藏
2020-07-25

共1个答案

小编典典

在GitHub设置中,提到了:

一些工具无需SSH即可连接到GitHub。要正确使用这些工具,您需要找到并配置您的API令牌。

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

注意 如果您更改了GitHub密码,则会创建一个新令牌,并且需要对其进行更新

即使您的ssh身份验证应该保持不变,也请确保Hudson用户使用的全局git配置已更新了一些github设置。


经过90分钟的讨论,事实证明,可能受到密码更改影响的另一个文件是您的 .netrc 文件

2020-07-25