[ 
https://issues.apache.org/jira/browse/MRELEASE-1161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941973#comment-17941973
 ] 

Michael Osipov commented on MRELEASE-1161:
------------------------------------------

[~kwin]

> Prepare goal does fail to push tag using SCM URL over SSH
> ---------------------------------------------------------
>
>                 Key: MRELEASE-1161
>                 URL: https://issues.apache.org/jira/browse/MRELEASE-1161
>             Project: Maven Release Plugin
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: windows 11
> maven 3.9.9
> git 2.47.1
>            Reporter: Nikolas Falco
>            Priority: Major
>
> We are moving our SCM developer connection from https that use a configured 
> appPassword credentials to git/ssh configured with a private SSH key.
> From
> {code:xml}
> <developerConnection>scm:git:https://bitbucket.org/owner/reponame.git</developerConnection>{code}
> with credentials in settings.xml like this:
> {code:xml}
>         <server>
>             <id>bitbucket.org</id>
>             <username>builder</username>
>             <password>secret</password>
>         </server>
> {code}
> To
> {code:xml}
> <developerConnection>scm:git:ssh://g...@bitbucket.org/owner/reponame.git</developerConnection>{code}
> with credentials in settings.xml like this:
> {code:xml}
>         <server>
>             <id>bitbucket.org</id>
>             <privateKey>fullpath/to/private/key</privateKey>
>         </server>
> {code}
> When we run {{mvn -ntp release:prepare}} we get the following error:
> {code:bash}
> [INFO] 11/17 prepare:scm-commit-release
> [INFO] Checking in modified POMs...
> [INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git rev-parse --show-prefix"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git status --porcelain ."
> [INFO] Working directory: D:\git\reponame
> [WARNING] Ignoring unrecognized line: ?? pom.xml.releaseBackup
> [WARNING] Ignoring unrecognized line: ?? release.properties
> [INFO] Executing: cmd.exe /X /C "git commit --verbose -F 
> C:\Users\nfalco\AppData\Local\Temp\maven-scm-2141752647.commit"
> [INFO] Working directory: D:\git\os-devops-organisation-pom
> [INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git push 
> ssh:********@bitbucket.org/owner/reponame.git 
> refs/heads/master:refs/heads/master"
> [INFO] Working directory: D:\git\reponame
> [INFO] 12/17 prepare:scm-tag
> [INFO] Tagging release with the label 1.13...
> [INFO] Executing: cmd.exe /X /C "git tag -F 
> C:\Users\nfalco\AppData\Local\Temp\maven-scm-699167272.commit 1.13"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git push 
> ssh:********@bitbucket.org/owner/reponame.git refs/tags/1.13"
> [INFO] Working directory: D:\git\reponame
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  15.470 s
> [INFO] Finished at: 2025-04-08T15:54:53+02:00
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-release-plugin:3.1.1:prepare (default-cli) on 
> project opensoftware-parent: Unable to tag SCM
> [ERROR] Provider message:
> [ERROR] The git-push command failed.
> [ERROR] Command output:
> [ERROR] g...@bitbucket.org: Permission denied (publickey).
> [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]
> {code}
> Commit {{[maven-release-plugin] prepare release 1.13}} is pushed with success 
> but fail to push annotated tag.
> If we add the environment variable
> {code:bash}
> GIT_SSH_COMMAND = "ssh -i d:\\builder.private.openssh"{code}
> the tag is pushed with success to remote
> {code:bash}
> ...
> [INFO] 12/17 prepare:scm-tag
> [INFO] Tagging release with the label 1.13...
> [INFO] Executing: cmd.exe /X /C "git tag -F 
> C:\Users\nfalco\AppData\Local\Temp\maven-scm-826466640.commit 1.13"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git push 
> ssh:********@bitbucket.org/owner/reponame.git refs/tags/1.13"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git ls-files"
> [INFO] Working directory: D:\git\reponame
> [INFO] 13/17 prepare:rewrite-poms-for-development
> [INFO] Transforming pom.xml opensoftware-parent 'Opensoftware'...
> [INFO] 14/17 prepare:remove-release-poms
> [INFO] Not removing release POMs
> [INFO] 15/17 prepare:run-completion-goals
> [INFO] 16/17 prepare:scm-commit-development
> [INFO] Checking in modified POMs...
> [INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git rev-parse --show-prefix"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git status --porcelain ."
> [INFO] Working directory: D:\git\reponame
> [WARNING] Ignoring unrecognized line: ?? pom.xml.releaseBackup
> [WARNING] Ignoring unrecognized line: ?? release.properties
> [INFO] Executing: cmd.exe /X /C "git commit --verbose -F 
> C:\Users\nfalco\AppData\Local\Temp\maven-scm-1969078592.commit"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
> [INFO] Working directory: D:\git\reponame
> [INFO] Executing: cmd.exe /X /C "git push 
> ssh:********@bitbucket.org/owner/reponame.git 
> refs/heads/master:refs/heads/master"
> [INFO] Working directory: D:\git\reponame
> [INFO] 17/17 prepare:end-release
> [INFO] Release preparation complete.
> {code}
> I supponse the configuration done by this plugin (or the SCM git provider) is 
> not the same when push commits and tags. The first one (commit) works like 
> expected using the private key configured in the settings.xml. The second one 
> (tag) seems ignore that settings requiring us inject in the git shell command 
> ENV variable



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to