【问题标题】:Git error 401 while accessing it via hudson's git plugin通过 hudson 的 git 插件访问它时出现 Git 错误 401
【发布时间】:2011-12-03 00:18:50
【问题描述】:

我在我的服务器上配置了 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

有什么想法吗??

【问题讨论】:

    标签: git github hudson jenkins


    【解决方案1】:

    在 GitHub 设置中提到:

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

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

    注意 如果您更改了 GitHub 密码,将创建一个新令牌并需要更新

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


    90 minutes of discussion 之后,发现另一个可能受密码更改影响的文件是您的.netrc 文件
    见“git clone over https 401 error and not asking for username or password

    【讨论】:

    • 无法正常工作,更改了全局设置,但错误信息还是一样。
    • @NikhilSharma:要检查的另一个设置是您的 Hudson 用户的 HOME 值,以确保其中有 HOME/.ssh/id_rsa(.pub) 文件。
    • 我尝试将公钥复制到 github ssh 密钥,但仍然无法正常工作。它仍然给我与上面相同的错误。
    • @NikhilSharma:您的意思是在更改密码之前,即使您的 GitHub 帐户上没有您的公共 ssh 密钥没有,它也可以工作?
    • 是的。奇怪的是,它在 github 帐户上没有我的 ssh 公钥。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-12
    • 2010-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多