Jenkins - 使用GIT_ASKPASS设置凭据

Sno*_*ash 19 jenkins

我在Jenkins中为bitbucket设置了一些凭据,并仔细检查了Credentials设置(例如手动登录)但是当我在Jenkins中尝试它时,它只是旋转永远给出这个输出:

> git config remote.origin.url <bitbucket url> # timeout=10
Fetching upstream changes from <bitbucket url>
> git --version # timeout=10
using GIT_ASKPASS to set credentials <bitbucket account email> Bitbucket
> git fetch --tags --progress <bitbucket url> +refs/heads/*:refs/remotes/origin/*
> git fetch --tags --progress <bitbucket url> +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)

请注意,公开时URL很好.但是当设置为Private时,它只是失败而没有输出.

反正有没有更详细的调试呢?

小智 19

我有一个类似的问题,Jenkins在Windows服务器上.我使用凭证管理器安装了git,每当它尝试签出私有存储库时,它都会等待我在服务器中手动输入凭据.禁用git凭证管理器为我修复了它.

我已经有了在git插件中输入凭据的选项,因此不需要单独的凭据管理器.

  • 确切地说,这是如何做到的:`git config --system --unset credential.helper`更多信息:http://stackoverflow.com/questions/37182847/how-to-disable-git-credential-manager-对于窗口 (22认同)
  • @BenButzer唉,这对我没用.还有其他任何建议吗? (2认同)

小智 7

这是在MacOSX上.我将Git路径上的Jenkins设置更改为/ usr/local/git以及使用git config取消设置credential.helper,两者都不起作用.

最后,通过在~jenkins/Library/Keychains文件夹中为jenkins创建默认的keychain文件来解决问题.这是步骤......

  • sudo su jenkins
  • mkdir~jenkins /图书馆/钥匙串
  • cd~jenkins/Library/Keychains
  • security create-keychain -p [pwd] ./Login.keychain
  • security login-keychain -d user -s ./Login.keychain
  • 检查默认密钥链设置正确安全性default-keychain
  • git fetch --tags --progress https://github.com/....git + refs/heads/:refs/remotes/origin /

之后,github用户ID /密码存储在jenkins默认密钥链中,它将用于jenkins构建.