java - 无法在 mvn 发布时将文件提交到 github:spring boot 中的准备
问题描述
请指导我在执行 mvn release:prepare 时如何继续进行,如果需要,请告诉我如何在我的项目中添加 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 推送插件的发布。
解决方案
您可以使用 HTTPS 而不是 SSH 来避免密钥交换。这是一个例子:
<scm>
<url>https://github.com/(username)/(repo)</url>
<connection>scm:git:https://github.com/(username)/(repo).git</connection>
</scm>
(username)
并相应地替换(repo)
。
推荐阅读
- r - R Studio 中 read_excel 函数的问题
- spring - 如何使用 Spring Webclient 在 GET URL 上传递 JSON
- react-native - --version 命令与 info 命令上的 React-native 版本不同
- excel - 首次使用 VBA 上传文档后,Sharepoint 工作流程未启动
- flutter - NetworkError.request(error: DioError [DioErrorType.other]: type 'Null' is not a subtype of type 'Object' | Flutter
- python-3.x - 手动(无 pip)安装 SpaCy 模块
- sql - 如何创建一个可以有多个值的 SQL 列?
- python - 为什么 mypy 不接受 list[str] 作为 list[Optional[str]]?
- node.js - Node.js - 如何使用 graphql 获取关联的模型数据?
- apache-kafka - 如何使用 kafka 与 JDBC sink 和 source 使用 python 连接