我已经面临这个问题很长时间了。我能够 ssh 克隆存储库并提交到相同的存储库,但是当尝试 mvn clean release:clean release:prepare release:perform
时构建失败,如下所示。
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d585e485f434c40486d4a445945584f035e4240486e42405d4c4354034e4240" rel="noreferrer noopener nofollow">[email protected]</a>: 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.
事情是当我尝试 mvn clean release:clean release:prepare release:perform
它应该使用 <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="385f514c785f514c504d5a164b57555d7b575548595641165b5755" rel="noreferrer noopener nofollow">[email protected]</a>
而不是<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="88fdfbedfae6e9e5edc8efe1fce0fdeaa6fbe7e5edcbe7e5f8e9e6f1a6ebe7e5" rel="noreferrer noopener nofollow">[email protected]</a>
。有人可以帮我解决这个问题吗?
最佳答案
要测试的一种解决方法是:
git config --global <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b8cdcad496dfd1ccf8dfd1ccd0cdda96dbd7d5" rel="noreferrer noopener nofollow">[email protected]</a>:.insteadOf <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="97e2e4f2e5f9f6faf2d7f0fee3ffe2f5b9f4f8fa" rel="noreferrer noopener nofollow">[email protected]</a>:
(假设 SSH URL 中使用 :
)
这样,Git 将被迫在其 SSH URL 中使用正确的用户。
关于java - git-push 命令失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70937351/