简体   繁体   English

Jenkins凭据插件和GIT客户端无法正常工作

[英]Jenkins credentials plugin and GIT client not working

I'm using the Git Client plugin to connect Jenkins to my repository (in theory). 我正在使用Git Client插件将Jenkins连接到我的存储库(理论上)。 I'm not able to connect to repo using basic HTTP authentication. 我无法使用基本HTTP身份验证连接到repo。 When I enter the username:password manually I'm able to connect. 当我输入用户名:手动密码我能够连接。 I've tried a number of different ways to connect and nothing seems to work as expected. 我已尝试了许多不同的连接方式,似乎没有任何工作按预期工作。 If I turn off my HTTP authentication Jenkins successfully connects and builds without issue. 如果我关闭我的HTTP身份验证,Jenkins成功连接并构建没有问题。 I'm using... 我正在使用...

  • Credentials 1.10 证书1.10
  • Jenkins Git Client plugin 1.6.3 Jenkins Git Client插件1.6.3
  • Jenkins Git plugin 2.0.3 Jenkins Git插件2.0.3
  • Apache, Git 1.7.1 on server Apache,Git 1.7.1在服务器上

If I try to set the path in the job configuration via something like http://username:password@git.mydomain.com it seems to autocheck the validaty of the path and does not complain. 如果我尝试通过http://username:password@git.mydomain.com之类的东西在作业配置中设置路径,它似乎会自动检查路径的有效性并且不会抱怨。 However, using this method when I actually build the job my server reports a password mismatch error (it shows the username but not the password in the error, I'm assuming a password is actually used though I'd love to know for sure). 但是,当我实际构建作业时使用此方法我的服务器报告密码不匹配错误(它显示用户名但不显示错误中的密码,我假设密码实际上已用,但我很想知道) 。 Here is the error in the Apache error_log: 这是Apache error_log中的错误:

user jenkins: authentication failure for "/info/refs": Password Mismatch

if I enter the same credentials in the credentials box it does not connect and spits out: 如果我在凭据框中输入相同的凭据,则它不会连接并吐出:

Failed to connect to repository : Command "git config --local credential.helper store --file=/var/lib/jenkins/tmp/git4177869325176518383.credentials" returned status code 129:
stdout: 
stderr: error: unknown option `local'
usage: git config [options]

I don't see --local in the git manual, perhaps there is a module I need? 我没有在git手册中看到--local,也许我需要一个模块?

I had the same problem. 我有同样的问题。 The issue is that the Jenkins Git plugin expects to have git version 1.8 or higher installed on the Jenkins server - but doesn't check that or warn you that you're using an out-of-date release. 问题是Jenkins Git插件希望在Jenkins服务器上安装git 1.8或更高版本 - 但不会检查或警告您使用的是过时的版本。 ( git 1.8 supports a --local option to be specified for git config ; git 1.7 doesn't.) git 1.8支持为git config指定--local选项; git 1.7不支持。)

There are a number of options available to you to workaround this: 您可以使用多种方法来解决此问题:

  1. Update the version of git installed on your server. 更新服务器上安装的git版本。
  2. Have Jenkins download git upon demand, and use that version for building your projects. 让Jenkins根据需要下载git,并使用该版本来构建项目。 (This takes quite a bit of configuration.) This option does not use the copy of git installed on your server. (这需要相当多的配置。)此选项不使用服务器上安装的git副本。
  3. Have Jenkins use JGit (pure Java version of git which does not require git to be installed on your server) - this uses the JGit that comes with the Jenkins Git Client, so far as I can tell. Jenkins使用JGit(git的纯Java版本,它不需要在服务器上安装git) - 这就是我使用Jenkins Git Client附带的JGit,据我所知。

Options 2 & 3 are available through the Add Git button on the Manage Jenkins/Configure System page in the Git/Git installations section. 可以通过Git / Git安装部分的Manage Jenkins / Configure System页面上的Add Git按钮获得选项2和3。

My server runs Ubuntu 10.4 LTS, for which there is no git 1.8 package available in the standard repositories, and I prefer not to install non-packaged software on my server, so that ruled out option 1 for me. 我的服务器运行Ubuntu 10.4 LTS,标准存储库中没有可用的git 1.8软件包,我不想在我的服务器上安装非打包软件,因此排除了我的选项1。 I found the configuration for option 2 to be too onerous, and didn't give me a warm feeling that it would continue to work for new git releases. 我发现选项2的配置过于繁琐,并没有给我一种温暖的感觉,它会继续适用于新的git版本。 So that left me with option 3, which has been working OK for me. 所以这给了我选项3,这对我来说一直很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM