【问题标题】:Maven release issue in JenkinsJenkins 中的 Maven 发布问题
【发布时间】:2017-09-12 05:06:01
【问题描述】:

我正在尝试使用 Jenkins 进行 maven 构建和更新版本。我无法更新项目版本,出现错误。如何解决这个问题?

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 发布:清洁发布:准备发布:执行

<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]

【问题讨论】:

    标签: maven github jenkins jenkins-pipeline


    【解决方案1】:

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

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

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

    【讨论】:

    • 您的意思是我正在使用 admin/admin 运行 Jenkins 作业。但 Github 不接受 Jenkins 工作用户签入代码。如何解决这个问题?我正在使用 Windows 7
    • 正如我提到的,检查你的环境变量,并添加 ssh -Tv,看看它在哪里寻找私钥。
    • 哪个环境变量?指导我
    • 用户名,你会在你过去的工作中看到它,链接环境变量
    • 使用“gnana”作为用户运行我的 jenkins 作业。指导我什么变量以及如何在 env 中链接?
    【解决方案2】:

    我已通过在我的 GitHub 中添加 SSH 密钥进行修复。下面提到的 YouTube 视频

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

    【讨论】:

      猜你喜欢
      • 2011-09-15
      • 1970-01-01
      • 2014-09-12
      • 1970-01-01
      • 2013-04-02
      • 2011-03-31
      • 1970-01-01
      • 1970-01-01
      • 2017-05-29
      相关资源
      最近更新 更多