我已经发布了这个问题:
自升级到Git客户端插件2.1.0以来,Jenkins无法读取Github密码
总之,我克隆了Jenkins 1.650的生产实例,并在Windows 2012上将克隆的实例升级到2.25。
作为其中的一部分,Git客户端插件从1.19.6升级到2.1.0,现在无法进行身份validation。
如果我再次降级这个插件,我的工作就完美了,但是使用升级后的插件运行时,作业会失败。
我现在已经注意到,我可以看到的一个区别是,在作业输出中,在它的工作实例中,有一条消息using .gitcredentials to set credentials并using GIT_ASKPASS to set credentials 。
我怀疑这是问题或至less是相关的,但我找不到方法来改变这一点。 以下失败作业的完整输出:
08:18:40 Cloning the remote Git repository 08:18:40 Cloning repository https://github.com/mycompany/myrepo.git 08:18:40 > C:\Program Files\Git\cmd\git.exe init C:\Program Files (x86)\Jenkins\workspace\project # timeout=10 08:18:40 Fetching upstream changes from https://github.com/mycompany/myrepo.git 08:18:40 > C:\Program Files\Git\cmd\git.exe --version # timeout=10 08:18:40 using GIT_ASKPASS to set credentials 08:18:40 > C:\Program Files\Git\cmd\git.exe fetch --tags --progress https://github.com/mycompany/myrepo.git +refs/heads/*:refs/remotes/origin/* 08:18:41 ERROR: Error cloning remote repo 'origin' 08:18:41 hudson.plugins.git.GitException: Command "C:\Program Files\Git\cmd\git.exe fetch --tags --progress https://github.com/mycompany/myrepo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: 08:18:41 stdout: 08:18:41 stderr: '*dds23' is not recognized as an internal or external command, 08:18:41 operable program or batch file. 08:18:41 error: unable to read askpass response from 'C:\Windows\TEMP\pass6274847349411211542.bat' 08:18:41 bash: /dev/tty: No such device or address 08:18:41 error: failed to execute prompt script (exit code 1) 08:18:41 fatal: could not read Password for 'https://[email protected]': No error 08:18:41 08:18:41 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745) 08:18:41 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489) 08:18:41 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:64) 08:18:41 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315) 08:18:41 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:512) 08:18:41 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054) 08:18:41 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094) 08:18:41 at hudson.scm.SCM.checkout(SCM.java:495) 08:18:41 at hudson.model.AbstractProject.checkout(AbstractProject.java:1278) 08:18:41 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604) 08:18:41 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) 08:18:41 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529) 08:18:41 at hudson.model.Run.execute(Run.java:1720) 08:18:41 at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) 08:18:41 at hudson.model.ResourceController.execute(ResourceController.java:98) 08:18:41 at hudson.model.Executor.run(Executor.java:401) 08:18:41 ERROR: null 08:18:41 Archiving artifacts 08:18:41 [htmlpublisher] Archiving HTML reports... 08:18:41 [htmlpublisher] Archiving at PROJECT level C:\Program Files (x86)\Jenkins\workspace\project\server.project\server.distribution\target\htmldocs\documentation to C:\Program Files (x86)\Jenkins\jobs\project\htmlreports\documentation 08:18:41 ERROR: Specified HTML directory 'C:\Program Files (x86)\Jenkins\workspace\project\server.project\server.distribution\target\htmldocs\documentation' does not exist. 08:18:41 [BFA] Scanning build for known causes... 08:18:41 [BFA] No failure causes found 08:18:41 [BFA] Done. 0s 08:18:41 Started calculate disk usage of build 08:18:41 Finished Calculation of disk usage of build in 0 seconds 08:18:41 Started calculate disk usage of workspace 08:18:41 Finished Calculation of disk usage of workspace in 0 seconds 08:18:42 Sending e-mails to: bob@yeah 08:18:43 Finished: FAILURE
编辑
根据鲍勃的build议,我已经成功地运行这些命令。
del c:\users\user-name\.gitconfig git config --global credential.helper manager git fetch --tags --progress https://stash/myproj/proj.git +refs/heads/*:refs/remotes/origin/*
但是,运行我的工作时输出是完全一样的。 仍然使用GIT_ASKPASS。 必须有办法恢复到.gitcredentials。
您不能将使用ASKPASS的Jenkins git客户端插件更改为使用.gitcredentials。 该插件没有可选的密码提示方法。
它在2.0之前的版本中使用了.gitcredentials,并在版本2.0和更高版本中切换到ASKPASS。 这个更改是为了使子模块身份validation可以在git客户端插件2.0中添加。
有一些开放的bug报告描述了一些基于Windows的用户名/密码设置不再适用于基于https访问git存储库的情况。 其中一些情况包括:
修复这些开放漏洞之前的一些临时替代scheme包括:
我认为这些凭证会被插件更新搞乱,所以我基本上清除了以前的所有设置并将其重置。 这就是我所做的,通过命令命令:
del c:\users\user-name\.gitconfig git config --global credential.helper manager git fetch --tags --progress https://stash/myproj/proj.git +refs/heads/*:refs/remotes/origin/*
在popup的对话框中inputID / PW
完成。 现在,当我运行任何git命令(包括jenkins版本中的这个ID),它不会再提示input密码,就像我更新插件之前一样。
Git客户端插件2.1.0 – > 2.2.0和Git插件2.5.2 – > 3.0.1后,同样的事情发生在我身上。 还原后,我没有修复它,我删除了这个文件中的所有[凭证]条目: c:\users\user\.gitconfig (即globals: git config --global --list ),然后重置(添加? ) 这个
git config --global credential.helper manager
然后做了一个示例git fetch,现在popup窗口inputID / PW,它与pipe理器一起caching。 随后的电话工作。
这是为我工作。
看起来,当你尝试连接到存储库,它不需要提供的凭据,而是需要存储的仓库提供的存储库URL的windowscredentials。
所以,我做这个工作的方式是:
login到从属服务器使用同一个用户使得jenkins节点运行(在我的情况下运行该服务的人)
使用git客户端来创buildgit的存储库,并且创build一个git克隆。 在那里你会被提示input凭据。 把正确的凭据,并确保你得到的文件在repositorioselect的位置。
检查通过控制面板\用户帐户\凭证pipe理器 – > Windows凭据存储的凭据。 (通用应该是一个与您的url相关的)
configuration任务以从GIT下载。 把url,应该没有警报消息红色。 我已经testing了这个工作没有在jenkins提供凭据。
你完成了!