詹金斯 - 克隆远程仓库时出错 'origin'

jenkins - Error cloning remote repo 'origin'

我已经在我的机器上本地设置了 Jenkins 服务器 运行。 配置 Jenkins 作业以克隆 BitBucket 存储库。还做了以下事情: * 最初生成 SSH 密钥以连接到 BitBucket。后来将其更改为使用在 Jenkins 的 "Credentials" 部分中配置的用户名和密码从 HTTPS 克隆 * 还对由于 Jenkins 作业而创建工作区的文件夹进行了初始化。在我的例子中是 C:\Jenkins\jobs\\workspace.

得到以下异常:

ERROR: Timeout after 10 minutes
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe     
fetch --tags --progress     
https://<AccountName>@bitbucket.org/<repositoryName>/<projectName>.git 
+refs/heads/*:refs/remotes/origin/*" returned status code -1
:stdout 
:stderr: 
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1745)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1489)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:315)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:512)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1054)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1094)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1720)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:544)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
ERROR: null

我设法解决了这个问题。 我确信这与 git.exe 路径有关,我是对的。 当我 运行 git bash 中的以下命令时,它为 git.exe

提供了不同的路径
$which git
/mingw64/bin/git

在我之前的配置中,我指向 git.exe 位置 /bin/git。