git 我如何使用带有@的用户的maven release插件?

xxls0lw8  于 12个月前  发布在  Git
关注(0)|答案(1)|浏览(189)

我正在使用Jenkins和release maven插件。
我的Jenkins工作是一个“maven”类型的工作,并配置为:
1.使用标识符user@domain和访问令牌git克隆项目
1.使用Maven 3.8.3启动以下目标:
-B -X发布:清理发布:准备发布:执行
下面是maven release plugin的配置:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>3.0.1</version>
  <configuration>
    <arguments>${arguments}</arguments>
    <tagNameFormat>@{project.version}</tagNameFormat>
  </configuration>
</plugin>

字符串
下面是与git repo相关的pom部分:

<properties>
    <java.version>8</java.version>
    <project.scm.id>gitlab</project.scm.id>
</properties>
<scm>
    <connection>scm:git:https://gitlab.some.domain/path/to/repo.git</connection>
    <developerConnection>scm:git:ssh://[email protected]/path/to/repo.git</developerConnection>
    <url>https://gitlab.some.domain/path/to/repo</url>
    <tag>HEAD</tag>
</scm>


下面是用户设置文件:

<settings>
  <servers>
    <server>
      <id>gitlab</id>
      <username>user@domain</username>
      <password>access token</password>
    </server>
  </servers>
</settings>


当运行Jenkins作业时,git clone部分是可以的。它使用Jenkins设置中提供的访问令牌凭证:user@domain/*(访问令牌)。
当涉及到maven发布插件git-push操作时,我在使用上面提供的用户设置文件时收到一个错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.1:prepare (default-cli) on project xxx: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] Permission denied, please try again.
[ERROR] Permission denied, please try again.
[ERROR] Received disconnect from 12.345.678.901 port 22:2:********@domain
[ERROR] Authentication 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] -> [Help 1]


这会不会是因为用户名中的字符@?

j2cgzkjk

j2cgzkjk1#

我留下了一个SSH URL而不是HTTPS,所以它应该是:

<developerConnection>scm:git:https://gitlab.some.domain/path/to/repo.git</developerConnection>

字符串

相关问题