4

I'm following instructions laid out here on how to publish to Sonatype and I'm running into an issue with the mvn release:prepare step. It get's up to this step then it stalls:

[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: C:\Users\Nicholas\git\Maven-Mule-REST-Plugin
[INFO] Executing: cmd.exe /X /C "git push git@github.com:NicholasAStuart/Maven-Mule-REST-Plugin.git master:master"
[INFO] Working directory: C:\Users\Nicholas\git\Maven-Mule-REST-Plugin

I've manually run that command myself and it asks for my passphrase, but I'm assuming that is what is stalling the release plugin. This is a Windows machine. How can I have this either prompt me, or can I provide this in the CLI argument to mvn?

Nicholas
  • 7,205
  • 8
  • 44
  • 72

3 Answers3

5

the maven-release-plugin shows the same problem behavior when pushing to a non ssh secured repository too (like any own configured http or https repository in a repo manager like Artifactory) if you have just missed to add the credentials to the Maven process.

so if you use http(s) always check you have added the credentials to the Maven process as parameters for the Maven Release plugin like...

mvn release:prepare -Dusername=ANYBODY -Dpassword=XXX
Hannes Kogler
  • 459
  • 6
  • 12
1

You would need to run an ssh-agent, in order to get that passphrase automatically provided for you.

ssh-add "/c/Users/YourUsename/.ssh/id_rsa"

See for more: "Maven - Error Releasing Code to GitHub (Hangs After Push)".

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
0

Follow these instructions on GitHub for password-free SSH:

Step 1: Check for SSH keys

ls -al ~/.ssh

Step 2: Generate a new SSH key

ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]

Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]

# start the ssh-agent in the background
ssh-agent -s
# Agent pid 59566
ssh-add ~/.ssh/id_rsa

Step 3: Add your SSH key to GitHub

clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

Step 4: Test everything out

ssh -T git@github.com
# Attempts to ssh to github
333kenshin
  • 1,916
  • 10
  • 17
  • > ssh-add ~/.ssh/id_rsa -- Could not open a connection to your authentication agent. – Brovoker Mar 26 '15 at 15:29
  • @Brovoker if you search StackOverflow using that error message you get a question that addresses it directly. http://stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent/17848593#17848593 – 333kenshin Mar 31 '15 at 18:10