Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用maven发布插件将发布推送到github?_Git_Maven_Github_Ssh_Ssh Keys - Fatal编程技术网

如何使用maven发布插件将发布推送到github?

如何使用maven发布插件将发布推送到github?,git,maven,github,ssh,ssh-keys,Git,Maven,Github,Ssh,Ssh Keys,我可以使用SSH将其推送到我的Gihub存储库,但在准备阶段尝试使用maven发布插件推送时出现了一个错误: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare (default-cli) on project netbeans-visual-diff-standalone: Unable to commit file Caused by: org.apache.maven.

我可以使用SSH将其推送到我的Gihub存储库,但在准备阶段尝试使用maven发布插件推送时出现了一个错误:

Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare (default-cli) on project netbeans-visual-diff-standalone: Unable to commit file

Caused by: org.apache.maven.shared.release.scm.ReleaseScmCommandException: Unable to commit files
Provider message:
The git-push command failed.
Command output:
nbauma109@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
我按照此处的所有步骤创建公钥/私钥,将公钥上载到我的github帐户,并将私钥添加到ssh代理:

我用发布插件配置和scm连接设置更新了maven POM:

<scm>
    <connection>scm:git:https://github.com/nbauma109/netbeans-visual-diff-standalone.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/nbauma109/netbeans-visual-diff-standalone.git</developerConnection>
    <url>https://github.com/nbauma109/netbeans-visual-diff-standalone</url>
    <tag>HEAD</tag>
</scm>
<distributionManagement>
   <repository>
     <id>pkg.github.com</id>
     <name>GitHub nbauma109 Apache Maven Packages</name>
     <url>https://maven.pkg.github.com/nbauma109/mvn-repo</url>
   </repository>
</distributionManagement>
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-release-plugin</artifactId>
      <version>3.0.0-M1</version>
      <configuration>
        <tagBase>ssh://git@github.com/nbauma109/netbeans-visual-diff-standalone/tags</tagBase>
      </configuration>
    </plugin>
  </plugins>
</build>
<properties>
    <project.scm.id>github.com</project.scm.id>
</properties>
当系统提示我输入版本和标签信息时,我只需按enter键选择默认值

  • 发行版本:2.0.1
  • 下一个开发版本:2.0.2-SNAPSHOT
另外,我也遇到了一些类似的帖子,OP说他通过在POM文件中的developerConnection/push部分添加公钥解决了这个问题,但我从来没有见过这样的事情,我认为这不是解决这个问题的地方

编辑(在@VonC的回答之后):将用户从nbauma109更改为git,并更新POM和maven settings.xml后,我现在有两个repo,github.com带有私钥身份验证,pkg.github.com带有个人令牌身份验证。现在,我可以将标记推送到github.com,并且可以将包推送到github包(pkg.github.com),前提是我的个人令牌github\u personal\u token具有“write package”权限


现在我的问题是,我推送了一个没有身份验证任何人都无法访问的包,并且我的发布标签中没有其他项目可以使用的二进制文件。除了使用Github web GUI手动将二进制文件重新上载到发布标签之外,我没有其他选择吗?

只要您看到
nbauma109@github.com
,您可以确保SSH推送将失败(从命令行或maven)

GitHub SSH URL将始终使用远程用户“
git
”:
git@github.com:…
,决不是实际的GitHub用户帐户名:您注册到所述GitHub帐户的公钥将用于验证您的身份

因此,从以下方面开始测试:

<username>git</username>
git

Ok现在它成功地推送了一个标记,但现在它在推送Github包时卡住了(没有错误)。我将相应地更新我的问题。@Sybuser这是一个完全独立的问题。
mvn -X -Dusername=git release:clean release:prepare release:perform
<username>git</username>