简体   繁体   English

使用 Jenkins git 插件的凭据

[英]Credentials on using Jenkins git plugin

We have installed a Git server and Jenkins (git plugin).我们已经安装了 Git 服务器和 Jenkins(git 插件)。 The install succeed.安装成功。 But when we configured a job for a build on Jenkins we had the following problem :但是当我们在 Jenkins 上为构建配置作业时,我们遇到了以下问题:

Started by user admin
[EnvInject] - Loading node environment variables.
Building in workspace C:\Program Files (x86)\Jenkins\jobs\HSH\workspace
> C:\Program Files (x86)\Git\bin\git.exe rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
> C:\Program Files (x86)\Git\bin\git.exe config remote.origin.url http://localhost/Bonobo.Git.Server/HomeScreenHome.git
Fetching upstream changes from http://localhost/Bonobo.Git.Server/HomeScreenHome.git
> C:\Program Files (x86)\Git\bin\git.exe --version
FATAL: Failed to fetch from http://localhost/Bonobo.Git.Server/HomeScreenHome.git
hudson.plugins.git.GitException: Failed to fetch from http://localhost/Bonobo.Git.Server/HomeScreenHome.git
    at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:622)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:854)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1254)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:624)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:530)
    at hudson.model.Run.execute(Run.java:1732)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:234)
Caused by: hudson.plugins.git.GitException: Failed to connect to http://localhost/Bonobo.Git.Server/HomeScreenHome.git using credentials  (status = 502)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkCredentials(CliGitAPIImpl.java:2111)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1151)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:265)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:620)
... 10 more

We have a git server configured with credentials and Http Url localhost/Bonobo.Git.Server/HomeScreenHome.git .我们有一个配置了凭据和 Http Url localhost/Bonobo.Git.Server/HomeScreenHome.git的 git 服务器。 We have configured the Jenkins Git plugin with the Git repository url and credentials relative to the repo.我们已经使用 Git 存储库 url 和与存储库相关的凭据配置了 Jenkins Git 插件。

We don't know why we have a 502 status error, and why git clone and git fetch works using git only.我们不知道为什么会出现 502 状态错误,以及为什么git clonegit fetch只能使用 git 工作。

  1. If it's on localhost, couldn't you simply use file:///... ?如果它在本地主机上,您不能简单地使用file:///...吗?
  2. Jenkins will probably run under a different user, so doing a clone with your normal user doesn't say much about what Jenkins can do. Jenkins 可能会在不同的用户下运行,因此对普通用户进行克隆并不能说明 Jenkins 可以做什么。 You'll need to add the proper credentials under Manage Jenkins -> Configure System您需要在Manage Jenkins -> Configure System下添加正确的凭据

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

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