gpt4 book ai didi

git - 如何让 Maven 发布插件通过 SSH 与 Git 一起使用?

转载 作者:行者123 更新时间:2023-12-02 13:46:57 25 4
gpt4 key购买 nike

我正在尝试通过 ssh 将 Maven Release 插件与 git 一起使用。
我运行命令 mvn 发布:准备 并得到以下错误:

[INFO] Working directory: C:\projects\sample
[INFO] Executing: cmd.exe /X /C "git push ssh://bill@hbox/sample master:master"
[INFO] Working directory: C:\projects\sample
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4:prepare (default-cli) on project sample: 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] Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
[ERROR] fatal: The remote end hung up unexpectedly

我的 pom.xml 中有以下内容:
<scm>
<developerConnection>scm:git:ssh://hbox/sample</developerConnection>
<tag>sample-1.1</tag>
</scm>

我使用公钥认证来访问 ssh 服务器,以及命令 ssh bill@hbox 无需提示输入密码即可工作。显然,maven 发布插件没有获取我的私钥,我可以判断,因为它正在执行一系列“cmd.exe”来运行 git。 那么我应该把我的私钥放在哪里,我该如何让 Maven 知道呢? 我查看了 Maven Release 插件的文档,但在配置中没有看到任何关于 ssh key 的内容。我在 settings.xml 文件中添加了一个新的服务器元素,但这也不起作用。您可以向我指出有关此问题的任何文档将不胜感激。其他注意事项:私钥不受密码保护。另外,我使用的是 Windows 7 和 cygwin。

最佳答案

我在这里找到了答案。我无法让 maven 发布插件在 cygwin 下工作,但是如果您使用 msysgit(打开 git-cmd.bat)然后输入命令“echo %HOME%”,然后将 id_rsa 放入 %HOME/.ssh。

MSysGit and ssh config. missing

关于git - 如何让 Maven 发布插件通过 SSH 与 Git 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14842046/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com