使用 Jenkins git 插件的凭据
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25038823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Credentials on using Jenkins git plugin
提问by Guillaume
We have installed a Git server and Jenkins (git plugin). The install succeed. But when we configured a job for a build on Jenkins we had the following problem :
我们已经安装了一个 Git 服务器和 Jenkins(git 插件)。安装成功。但是当我们在 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.access0(CliGitAPIImpl.java:87)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.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
. We have configured the Jenkins Git plugin with the Git repository url and credentials relative to the repo.
我们有一个配置了凭据和 Http Url 的 git 服务器 localhost/Bonobo.Git.Server/HomeScreenHome.git
。我们已经使用 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 clone
和git fetch
作品只使用Git。
回答by xeraa
- If it's on localhost, couldn't you simply use
file:///...
? - 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. You'll need to add the proper credentials under Manage Jenkins-> Configure System
- 如果它在本地主机上,你不能简单地使用
file:///...
吗? - Jenkins 可能会在不同的用户下运行,因此与普通用户进行克隆并不能说明 Jenkins 可以做什么。您需要在Manage Jenkins-> Configure System下添加正确的凭据