尽管密钥已生成,但jenkins仍抱怨主机密钥验证失败

时间:2012-05-23 15:59:32

标签: git ubuntu github hudson jenkins

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. 我发现jenkins构建在执行时失败了

    git fetch -t git@github.com:...../......git +refs/heads/*:refs/remotes/origin/*
    
  2. 然后我在命令行上粘贴了相同的命令,它成功执行了,很奇怪!

  3. 执行以下操作以确保密钥有效:

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

    建议在http://help.github.com/ssh-issues/

  4. 我尝试将生成的私有ssh密钥复制到Jenkins下面的.ssh文件夹中

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

    并将.gitconfig文件复制到/ var / lib / jenkins

    建议于:Jenkins fails with github "git clone"

1 个答案:

答案 0 :(得分:0)

修正:

但我在项目中没有任何紧张的配置。所以删除它并重新创建另一个。这次...........我刚刚登录系统并 ** DID NOT SUDO ** 来创建git配置。而只是执行git config user.email“emailid@abc.com”和git config user.name“用户名”。詹金斯构建成功!

替代解决方案:.git由root拥有,而其他人由jenkins拥有。解决方法是:happy-coding.com/...