【问题标题】:How to do manual git clone in Jenkins over SSH如何通过 SSH 在 Jenkins 中进行手动 git 克隆
【发布时间】:2017-11-08 22:23:20
【问题描述】:

在大多数情况下,我使用 git plugin 我选择凭据(用户名 - 私钥)并使用 ssh://git@server.com:7999/project/repo.git 作为 URL。这工作正常。可以克隆。

现在我尝试对 ssh-agent plugin 而不是 git-plugin 做同样的事情。

我使用 SSH-agent 插件并选择凭证(就像使用 git 插件一样)。 比我选择执行一个shell:

git version;
git clone ssh://git@server.com:7999/project/repo.git

这不起作用。我做错了什么?

Host key verification failed.
fatal: Could not read from remote repository.

【问题讨论】:

    标签: git jenkins ssh


    【解决方案1】:

    这意味着远程主机的主机密钥已更改。 (防止中间人攻击)

    手动编辑文件:

    ~/.ssh/known_hosts
    

    或者使用命令:

    ssh-keygen -R hostname
    

    也试试这个。添加您的主机以了解主机:

    ssh-keyscan -t rsa YOUR_HOST.DOMAIN >> ~/.ssh/known_hosts
    

    【讨论】:

    • 执行了所有步骤,删除了旧的,添加了新的,但仍然是同样的问题。
    • 请在您的 ssh 命令中添加该标志:ssh -oStrictHostKeyChecking=no:例如:export GIT_SSH_COMMAND="ssh -oStrictHostKeyChecking=no"
    猜你喜欢
    • 2016-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-16
    • 2016-05-07
    • 2021-10-19
    • 1970-01-01
    相关资源
    最近更新 更多