詹金斯的Maven发布问题

时间:2017-09-12 05:06:02

标签: maven github jenkins jenkins-pipeline

我正在尝试使用maven build&使用Jenkins更新版本。我无法更新项目版本,收到错误。如何解决这个问题?

  

Jenkins版本:2.7.1 WAR Maven:3 Windows 7

<scm>
    <connection>scm:git:git@github.com:username/test-app.git</connection>
    <url>scm:git:git@github.com:username/test-app.git</url>
    <developerConnection>scm:git:git@github.com:username/test-app.git</developerConnection>
  </scm>

Maven目标

-X release:clean release:prepare release:perform

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
            </plugin>

错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project test-app: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] Host key verification failed.
[ERROR] fatal: Could not read from remote repository.
[ERROR] 
[ERROR] Please make sure you have the correct access rights
[ERROR] and the repository exists.
[ERROR] 
[ERROR] -> [Help 1]

2 个答案:

答案 0 :(得分:1)

我通常会看到这一点,因为Jenkins作业使用与拥有私钥的帐户不同的帐户(或Windows系统帐户)运行。

您必须确保Jenkins作业(检查其环境变量)具有%USERPROFILE%\.ssh\id_rsa(或$HOME/.ssh/id_rsa)具有正确的私有ssh密钥(最好没有密码短语,以避免所有选美密码短语缓存问题) )。

您可以添加ssh -Tv git@github.com构建步骤,仅用于测试。

答案 1 :(得分:0)

我已经修复了在我的GitHub中添加SSH密钥。按照下面提到的YouTube视频

https://www.youtube.com/watch?v=H5qNpRGB7Qw