You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用含@符号用户名时Maven Release Plugin执行Git推送失败的问题求助

含@符号用户名时Maven Release Plugin执行Git推送失败的问题求助

大家好,我目前在Jenkins中搭配Maven Release插件做项目发布,遇到了一个权限认证的问题,想请教下各位。

我的Jenkins任务是Maven类型,配置情况如下:

  • 用Git克隆项目时,使用的凭据是user@domain和访问令牌,这一步完全正常,能顺利拉取代码
  • 指定用Maven 3.8.3执行目标:-B -X release:clean release:prepare release:perform

以下是我的Maven Release插件配置:

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

POM文件中与Git仓库相关的配置片段:

<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://git@gitlab.some.domain/path/to/repo.git</developerConnection>
  <url>https://gitlab.some.domain/path/to/repo</url>
  <tag>HEAD</tag>
</scm>

用户settings文件的配置内容:

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

现在的问题是:Jenkins克隆代码的环节没问题,但执行Maven Release插件的Git推送操作时,出现了权限认证失败的错误,具体报错信息如下:

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

我怀疑会不会是用户名里的@符号导致了认证异常?有没有朋友遇到过类似的情况,或者知道怎么解决这个问题的?

备注:内容来源于stack exchange,提问作者Nicolas Baumann

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 07:08:11