在mvn版本中无法将文件提交到github:在春季启动中准备

时间:2019-01-19 08:38:44

标签: java git maven spring-boot maven-release-plugin

请指导我如何在执行mvn发行版时继续进行操作:在我的Spring Boot项目中进行准备还请告诉我如何在需要时向我的项目添加ssh密钥。 我尝试了许多解决方案,但都无济于事,因为它每次都会显示相同的错误,这是我基于模块化方法的项目,而我正在使用的IDE是IntelliJ。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release- plugin:2.5.3:prepare (default-cli) on project vj-pet-clinic: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] git@github.com: Permission denied (publickey).
[ERROR] fatal: Could not read from remote repository.
[ERROR] Please make sure you have the correct access rights
[ERROR] and the repository exists.
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

我的pom.xml文件是:-

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<modules>
    <module>pet-clinic-data</module>
    <module>pet-clinic-web</module>
</modules>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.2.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.vinamra</groupId>
<artifactId>vj-pet-clinic</artifactId>
<version>0.0.1</version>
<name>vj-pet-clinic</name>
<description>VJ pet clinic project</description>

<properties>
    <java.version>1.8</java.version>
</properties>

<dependencies>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
                <goals>install</goals>
                <checkModificationExcludes>
                    <checkModificationExclude>pom.xml</checkModificationExclude>
                </checkModificationExcludes>
            </configuration>
        </plugin>
    </plugins>
</build>

<scm>
  <developerConnection>scm:git:git@github.com:username/repository.git</developerConnection>
  <tag>vj-pet-clinic-0.0.1</tag>

请帮助我如何使用Maven推送插件。

1 个答案:

答案 0 :(得分:0)

您可以使用HTTPS而不是SSH来避免密钥交换。这是一个示例:

  <scm>
        <url>https://github.com/(username)/(repo)</url>
        <connection>scm:git:https://github.com/(username)/(repo).git</connection>
  </scm>

相应地替换(username)(repo)