我对Jenkins(和Stackoverflow)完全陌生,并且正在设置一个简单的Jenkins作业以轮询git存储库。
1)我在本地计算机上创建了一个git存储库。2)我创建了一个Jenkins Freestyle作业,并在配置屏幕上输入了以下参数:
资料库URL:media@127.0.0.1:/ home / media / git_repo_remote凭证:无
在“存储库URL”文本字段下显示以下错误:
Failed to connect to repository : Command "git ls-remote -h media@127.0.0.1:/home/media/git_repo_remote HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: Could not read from remote repository.
Run Code Online (Sandbox Code Playgroud)
请确保您具有正确的访问权限,并且存储库存在。
然后,我将资源库URL更改为“ https:///127.0.0.1/home/media/git_repo_remote ”,并在日志中收到以下内容:
Started by an SCM change
Building in workspace /var/lib/jenkins/workspace/First Job
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https:///127.0.0.1/home/media/git_repo_remote # timeout=10
Fetching upstream changes from https:///127.0.0.1/home/media/git_repo_remote
> git --version # timeout=10
> git fetch --tags --progress https:///127.0.0.1/home/media/git_repo_remote +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
> git rev-parse origin/master^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激。
谢谢
请检查存储库是否使用 main 或 master 并相应地在 jenkins JOB 配置中更改相同的内容
源代码管理 > 要构建的分支 - > /*main 或 /*master (根据 gitlab 或 github 或任何其他 scm 平台上的 REPO)
所以我有3个建议:
将“ https:///127.0.0.1/home/media/git_repo_remote ”视为 git 远程 url - 您确定已正确配置 http 服务器吗?您是否尝试在詹金斯机器(或詹金斯正在执行其作业的代理)上的任何浏览器中打开此地址?
将“media@127.0.0.1:/home/media/git_repo_remote”视为git远程 - 正如@LethalProgramme提到的问题是jenkins机器(代理)上的localhost的主机验证密钥不正确。因此,在某个时刻,您的 jenkins 机器的 SSH 主机验证密钥已更改。您可以做的是 ssh 到该机器并执行:ssh-keygen -R 127.0.0.1或ssh-keygen -R localhost以与 jenkins 相同的用户身份执行。有关更多详细信息,请参阅此问题及其答案。
我相信最简单的解决方案是使用 git 本地协议而不是 ssh 或 https。因此,将远程 url 设置为:/home/media/git_repo_remote或file:///home/media/git_repo_remote
| 归档时间: |
|
| 查看次数: |
5070 次 |
| 最近记录: |