Jenkins 在进入存储库 URL 时显示为 "Failed to connect to repository"
Jenkins shows as "Failed to connect to repository" on enter of repository URL
这里显示的是错误消息
Failed to connect to a repository: Command "C:\Program Files\Git\bin\git.exe ls-remote -h https://github.com/org/project.git HEAD" returned status code 128:
stdout:
stderr: Login failed, use ctrl+c to cancel basic credential prompt.
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/org/project.git/'
附上所示错误的屏幕截图:-
enter image description here
关于配置问题,我遍历了多个平台,但其中 none 似乎与相同的平台同步。他们中的一些人谈论 git 似乎是正确的可执行路径,但不知道这里实际验证的是 git 未找到存储库。即使提供了有效凭据,它也会显示相同的错误。
在 运行 尝试从头开始配置的构建显示上述错误消息后,在 100 个构建不知道出了什么问题后开始显示此错误消息。但是在另一台具有相同设置的机器上能够 运行 作业。有人可以告诉我机器是否也有问题吗?
作业日志:-
Started by user Tom
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Create
using credential "xyz"
git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
git.exe config remote.origin.url giturl # timeout=10
Fetching upstream changes from giturl
git.exe --version # timeout=10
using GIT_ASKPASS to set credentials xyz git
git.exe fetch --tags --force --progress giturl +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from giturl
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:894)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1148)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1179)
at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1810)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --tags --force --progress giturl +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Not Found
fatal: repository 'giturl/' not found
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:442)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:892)
... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
从日志中我看到您正在尝试访问虚假的 giturl
而不是存储库的实际地址。:
"C:\Program Files\Git\bin\git.exe fetch --tags --force --progress giturl +refs/heads/*:refs/remotes/origin/*" returned status code 128:
... ####^HERE^####
...
fatal: repository 'giturl/' not found
因此,您需要指定 Git 存储库的实际 URL 而不是 giturl
(类似于 git@github.com:Company/Repo.git
)。
感谢大家的建议,我按照以下步骤解决了我的问题
1.Run 这个 git.exe ls-remote URL 通过命令行
2.Then 提供 git 凭据
3.After 成功执行上述步骤后,您将找到存储库的负责人...如下面的屏幕截图所示
[1]: https://i.stack.imgur.com/AYj7k.jpg
4.Now 转到 Jenkins,在 SCM 中提供您的 git 存储库 URL && 然后在凭据中添加您的 git 的凭据。
那么上面的“无法连接到版本库”的问题就解决了
有同样的问题,对我有用的只是将克隆 URL 从 SSH 更改为 HTTPS
这里显示的是错误消息
Failed to connect to a repository: Command "C:\Program Files\Git\bin\git.exe ls-remote -h https://github.com/org/project.git HEAD" returned status code 128:
stdout:
stderr: Login failed, use ctrl+c to cancel basic credential prompt.
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/org/project.git/'
附上所示错误的屏幕截图:- enter image description here
关于配置问题,我遍历了多个平台,但其中 none 似乎与相同的平台同步。他们中的一些人谈论 git 似乎是正确的可执行路径,但不知道这里实际验证的是 git 未找到存储库。即使提供了有效凭据,它也会显示相同的错误。
在 运行 尝试从头开始配置的构建显示上述错误消息后,在 100 个构建不知道出了什么问题后开始显示此错误消息。但是在另一台具有相同设置的机器上能够 运行 作业。有人可以告诉我机器是否也有问题吗?
作业日志:-
Started by user Tom
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Create
using credential "xyz"
git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
git.exe config remote.origin.url giturl # timeout=10
Fetching upstream changes from giturl
git.exe --version # timeout=10
using GIT_ASKPASS to set credentials xyz git
git.exe fetch --tags --force --progress giturl +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from giturl
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:894)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1148)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1179)
at hudson.scm.SCM.checkout(SCM.java:504)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1208)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1810)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: hudson.plugins.git.GitException: Command "C:\Program Files\Git\bin\git.exe fetch --tags --force --progress giturl +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Not Found
fatal: repository 'giturl/' not found
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2042)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1761)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access0(CliGitAPIImpl.java:72)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.execute(CliGitAPIImpl.java:442)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:892)
... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
从日志中我看到您正在尝试访问虚假的 giturl
而不是存储库的实际地址。:
"C:\Program Files\Git\bin\git.exe fetch --tags --force --progress giturl +refs/heads/*:refs/remotes/origin/*" returned status code 128:
... ####^HERE^####
...
fatal: repository 'giturl/' not found
因此,您需要指定 Git 存储库的实际 URL 而不是 giturl
(类似于 git@github.com:Company/Repo.git
)。
感谢大家的建议,我按照以下步骤解决了我的问题
1.Run 这个 git.exe ls-remote URL 通过命令行
2.Then 提供 git 凭据
3.After 成功执行上述步骤后,您将找到存储库的负责人...如下面的屏幕截图所示 [1]: https://i.stack.imgur.com/AYj7k.jpg
4.Now 转到 Jenkins,在 SCM 中提供您的 git 存储库 URL && 然后在凭据中添加您的 git 的凭据。
那么上面的“无法连接到版本库”的问题就解决了
有同样的问题,对我有用的只是将克隆 URL 从 SSH 更改为 HTTPS