Jenkins抱怨主机密钥验证失败,尽管密钥已经生成。

3
Error:
Fetching upstream changes from git@github.com:....../.........git
    ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
    hudson.plugins.git.GitException: Error performing command: git fetch -t git@github.com:....../......git +refs/heads/*:refs/remotes/origin/*
    Command "git fetch -t git@github.com:...../......git +refs/heads/*:refs/remotes/origin/*" returned status code 128: Host key verification failed.
    fatal: The remote end hung up unexpectedly

我的评论:

  1. I found that jenkins build fails when it executes

    git fetch -t git@github.com:...../......git +refs/heads/*:refs/remotes/origin/*
    
  2. I then pasted the same command on the command line it executes it successfully, weird!

  3. Executed the following to ensure the key works:

    ssh -T git@github.com
    Hi [username]! You've successfully authenticated, but GitHub does not provide shell access.
    

    Suggested in http://help.github.com/ssh-issues/

  4. I did try to copy the generated private ssh key into the .ssh folder beneath Jenkins

    cp -rf /root/.ssh /var/lib/jenkins/.ssh
    

    and also copied the .gitconfig file into /var/lib/jenkins

    Suggested in: Jenkins fails with github "git clone"


它引用的是主机密钥,而不是您的公共/私有密钥。 - robert
当您在命令行上尝试时,是否以与Jenkins正在运行的相同用户身份运行? 您需要将主机密钥添加为Jenkins用户的允许主机。 - codemonkey
给罗伯特:谢谢,我会检查这个。 - nab
给程序员codemonkey:是的,我从Jenkins网站登录为自己来运行已配置的构建。但是,我在jenkins系统中执行了'sudo'以在命令提示符下执行它。我将尝试后者建议并查看是否解决了问题。非常感谢。 - nab
已解决:.git文件夹的所有者是root,而其他文件夹的所有者是jenkins。解决方法是:http://happy-coding.com/jenkins-github-and-host-key-verification-failed/ - nab
但是我在项目中没有任何重要的配置需要丢失。所以我删除了它并重新创建了另一个。这一次……我只是登录到系统中,并且没有使用SUDO来创建git配置。相反,只需执行git config user.email "emailid@abc.com"和git config user.name "用户名"。Jenkins构建成功了! - nab
1个回答

0

已修复:

但是我在项目中没有任何重要的配置需要保留。所以我删除了它并重新创建了一个新的。这一次......我只是登录系统,** 没有使用SUDO **来创建git配置。而是执行了git config user.email "emailid@abc.com"和git config user.name "用户名"。Jenkins构建成功了!

备选方案:.git文件的所有者是root,而其他文件的所有者是jenkins。解决方法是:happy-coding.com/...


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接