2013-02-12 116 views
2

我試圖通過ssh使用Maven Release插件與git。
我運行命令MVN發佈:準備並得到以下錯誤:如何讓Maven Release Plugin通過SSH與Git協同工作?

[INFO] Working directory: C:\projects\sample 
[INFO] Executing: cmd.exe /X /C "git push ssh://[email protected]/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密鑰的信息。我添加了一個新的服務器元素到我的settings.xml文件,但是這也不起作用。任何文件,你可以指出我在這個問題上將不勝感激。其他說明:私鑰不受密碼保護。另外,我在Windows 7和Cygwin上。

+0

http://stackoverflow.com/questions/2796303/maven-wont-use-public-key-to-deploy – 2013-02-12 21:23:10

回答

2

我在這裏找到了答案。我無法讓maven release插件在cygwin下工作,但是如果你使用msysgit(打開git-cmd.bat),然後輸入命令「echo%HOME%」,然後將id_rsa放入%HOME /的.ssh。

MSysGit and ssh config. missing

+0

我MSysGit的這個解決問題/ SSH沒有找到 「id_rsa」 鍵 – Nightingale7 2013-05-29 06:46:03

相關問題