我正在尝试使用 Git 插件在 Jenkins 中配置一个 Git 项目。在项目配置页面中,我在 Git 配置中输入存储库 URL,这是一个 https URL ( https://git.mycompany.com/git/MyProject.git )。但是,当我构建项目时,出现以下错误:
Started by user Hudson Administrator
[EnvInject] - Loading node environment variables.
Building in workspace /home/hudson/.hudson/jobs/MyProject/workspace
Checkout:workspace / /home/hudson/.hudson/jobs/MyProject/workspace - hudson.remoting.LocalChannel@3699cfcc
Using strategy: Default
Cloning the remote Git repository
Cloning repository https://git.mycompany.com/git/MyProject.git
git --version
git version 1.8.2.1
ERROR: Error cloning remote repo 'origin' : Could not clone https://git.mycompany.com/git/MyProject.git
hudson.plugins.git.GitException: Could not clone https://git.mycompany.com/git/MyProject.git
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:286)
at org.jenkinsci.plugins.gitclient.AbstractGitAPIImpl.clone(AbstractGitAPIImpl.java:59)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.clone(CliGitAPIImpl.java:47)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1012)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
at hudson.FilePath.act(FilePath.java:912)
at hudson.FilePath.act(FilePath.java:885)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:557)
at hudson.model.Run.execute(Run.java:1665)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:507)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)
Caused by: hudson.plugins.git.GitException: Failed to connect to https://git.mycompany.com/git/MyProject.git
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getURLWithCrendentials(CliGitAPIImpl.java:1374)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getURLWithCrendentials(CliGitAPIImpl.java:1326)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:47)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:280)
... 16 more
Trying next repository
ERROR: Could not clone repository
java.io.IOException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1025)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:948)
at hudson.FilePath.act(FilePath.java:912)
at hudson.FilePath.act(FilePath.java:885)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:948)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1114)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:557)
at hudson.model.Run.execute(Run.java:1665)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:507)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:230)
我可以从命令行克隆存储库,也可以git clone
在 Jenkins 项目预构建步骤中作为 shell 命令执行,所以我不知道为什么插件配置不起作用。认为这可能是一个身份验证问题,我尝试在 .netrc 文件中指定凭据,并将它们包含在 URL 中(即https://username:password@git.mycompany.com/git/MyProject.git)但是在在所有情况下,我仍然遇到同样的错误。有任何想法吗?