我在我的服务器上配置了 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
有什么想法吗??
最佳答案
在 GitHub 设置中,提到了:
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.
即使您的 ssh 身份验证应该保持不变,也要确保 Hudson 用户使用的全局 git 配置更新了一些 github 设置。
在 90 minutes of discussion 之后,事实证明另一个可能受密码更改影响的文件是您的 .netrc
文件。
参见“git clone over https 401 error and not asking for username or password”
关于通过 hudson 的 git 插件访问时出现 Git 错误 401,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7687671/