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

标签 git github hudson 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

有什么想法吗??

最佳答案

在 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/

相关文章:

git - 是否有 Git Server Side Hook 可以为存储库大小设置配额?

javascript - 使用 Node GitHub API 在本地克隆远程仓库

git - Jenkins - 提升构建和 Git

build - 触发 hudson/cloudbees 从 Atlassian Jira 构建?

git - 在 GitHub 和 VSTS 上托管 git 存储库

TFS 构建步骤无法识别 Git?

git - 如何在不提交/添加任何文件或修改任何文件的情况下检查远程 GIT 存储库权限

java - Hudson 上的 Maven 构建随机失败

git log - 行太长 - 没有换行符

git - npm 从 github repo 子文件夹安装包