小编典典

Git获取失败

jenkins

我是詹金斯的新手。我只是在Windows
2016服务器上设置了詹金斯。我正在创建将git用于scm的新作业。当我去建立工作时,它会创建文件夹和git。它卡在git
fetch上。它超时。我已经将詹金斯设置为服务。我使用本地管理员帐户登录服务器,以尝试消除权限问题。从git
fetch日志中显示的错误是GitException,然后返回状态代码-1073741510。我搜索了,找不到任何地方的错误号。如果我打开命令窗口并转到使用完全相同的用户身份登录的完全相同的文件夹,然后发出完全相同的访存命令,它将正常工作。谁能帮我弄清楚从这里去哪里可以解决这个问题?

这是构建日志。

我抽象了事物的名称:

13:01:51 Started by user Admin
13:01:51 Building in workspace D:\Jenkins\workspace\MyProject - Staging
13:01:51 Cloning the remote Git repository
13:01:51 Cloning repository ssh://myserver.com/git/Software.git
13:01:51 > git.exe init D:\Jenkins\workspace\MyProject - Staging # timeout=10
13:01:51 Fetching upstream changes from ssh://myserver.com/git/Software.git
13:01:51 > git.exe --version # timeout=10
13:01:52 using GIT_ASKPASS to set credentials
13:01:52 > git.exe fetch --tags --progress ssh://myserver.com/git/Software.git +refs/heads/:refs/remotes/origin/ # timeout=5
13:06:52 ERROR: Timeout after 5 minutes
13:06:52 ERROR: Error cloning remote repo 'origin'
13:06:52 hudson.plugins.git.GitException: Command "git.exe fetch --tags --progress ssh://myserver.com/git/Software.git +refs/heads/:refs/remotes/origin/" returned status code -1073741510:
13:06:52 stdout:
13:06:52 stderr:
13:06:52 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
13:06:52 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)
13:06:52 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:72)
13:06:52 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:442)
13:06:52 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:655)
13:06:52 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1146)
13:06:52 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
13:06:52 at hudson.scm.SCM.checkout(SCM.java:504)
13:06:52 at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
13:06:52 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
13:06:52 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
13:06:52 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
13:06:52 at hudson.model.Run.execute(Run.java:1810)
13:06:52 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
13:06:52 at hudson.model.ResourceController.execute(ResourceController.java:97)
13:06:52 at hudson.model.Executor.run(Executor.java:429)
13:06:52 ERROR: Error cloning remote repo 'origin'
13:06:52 Finished: FAILURE

当我在同一文件夹中的命令行中手动执行git fetch时,它可以正常工作,并且不到2分钟。


阅读 423

收藏
2020-07-25

共1个答案

小编典典

我发现了一个非常类似于您的问题。

简而言之,一种快速的解决方案是卸载/重新安装git-for-window,并确保在安装过程中禁用“ Enable Git Credential
Manager”选项。

默认情况下启用此选项,并将git属性credential.helper设置在系统级别。这将迫使git客户端使用Windows的Git凭据管理器,而不是Jenkins提供的本地配置。因此,它会使您的构建挂起(如果以系统帐户身份运行节点)或失败(如果以本地用户身份运行节点)。

Git for Windows安装程序屏幕截图

此链接上还有其他两种解决方案。

https://support.cloudbees.com/hc/zh-CN/articles/221046888-Build-Hang-or-Fail-
with-Git-for-Windows

2020-07-25