【问题标题】:Issue in cloing private repo using the jenkins, ERROR: Error cloning remote repo 'origin'使用詹金斯 cloing private repo 时出现问题,ERROR: Error cloning remote repo 'origin'
【发布时间】:2021-06-09 01:45:55
【问题描述】:
  1. 我能够克隆公共存储库,但在使用 jenkins 时遇到了私有存储库的问题。
  2. 我可以使用命令提示符克隆私有仓库。
  3. 我可以使用 tortoise git 克隆私有 repo。
  4. 但无法使用 jenkins 克隆私有 repo。

Jenkins 版本:

詹金斯 2.263.4

git 路径一定没有问题。我已经解决了许多类似的问题,但没有一个答案能够解决问题。

Wiping out workspace first.
Cloning the remote Git repository
Cloning repository https://github.com/user/module_name.git
 > C:\Program Files\Git\mingw64\bin\git.exe init C:\Workspace\workspace\Walky # timeout=10
Fetching upstream changes from https://github.com/user/module_name.git
 > C:\Program Files\Git\mingw64\bin\git.exe --version # timeout=10
 > git --version # 'git version 2.30.1.windows.1'
using GIT_ASKPASS to set credentials Vivek git credtials for jenkins Jenkins 
 > C:\Program Files\Git\mingw64\bin\git.exe fetch --tags --force --progress -- https://github.com/user/module_name.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "C:\Program Files\Git\mingw64\bin\git.exe fetch --tags --force --progress -- https://github.com/user/module_name.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: remote: Repository not found.
fatal: repository 'https://github.com/user/module_name.git/' not found

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:573)
    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:802)
    at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1221)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1299)
    at hudson.scm.SCM.checkout(SCM.java:505)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1206)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:637)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:509)
    at hudson.model.Run.execute(Run.java:1907)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
ERROR: Error cloning remote repo 'origin'
Finished: FAILURE

【问题讨论】:

    标签: git jenkins github


    【解决方案1】:

    首先检查 Jenkins 使用哪个帐户运行。

    在 Windows 上,它可以run locally with a LocalSystem 代替您自己的帐户。

    您可以通过一个简单的 bat shell 步骤检查 Jenkins 作业:

    git config --global -l --show-origin
    

    您将看到全局 Git 配置在哪里

    如果它没有像您一样运行,Jenkins 将无法从必须缓存远程存储库托管服务凭据(用户名/密码)的同一个 Windows 凭据管理器中受益。
    这就是为什么您会收到 404 Not Found。

    【讨论】:

      猜你喜欢
      • 2017-07-13
      • 2019-10-03
      • 2015-11-20
      • 1970-01-01
      • 2015-07-20
      • 2014-03-29
      • 1970-01-01
      • 2015-01-04
      • 2023-03-07
      相关资源
      最近更新 更多