原文:http://stackoverflow.com/questions/3243755/maven-error-releasing-code-to-github-hangs-after-push
I have run into the same problem and I traced this to the fact that git is requiring a passphrase, but Maven has no way to specify an appropriate passphrase, so the process essentially hangs. Note that this problem is limited to Windows.
The solution is to run ssh-agent. This can be found in C:\Program
. After you run it, it outputs some environment variables that you need to set. For example:
Files (x86)\Git\bin\
SSH_AUTH_SOCK=/tmp/ssh-LhiYjP7924/agent.7924; export SSH_AUTH_SOCK;
SSH_AGENT_PID=2792; export SSH_AGENT_PID;
echo Agent pid 2792;
So, you need to place these in your environment:
C:\>
set SSH_AUTH_SOCK=/tmp/ssh-LhiYjP7924/agent.7924C:\>
set SSH_AGENT_PID=2792
Then, you will need to add a passphrase for your particular key file. Generally, if you issued a command likegit
for your project, you will get a passphrase prompt like:
fetch origin masterEnter
-- that is the file that you need to register with the agent. So, the command is:
passphrase for key '/c/Users/Anthony Whitford/.ssh/id_rsa'
C:\>
ssh-add "/c/Users/Anthony Whitford/.ssh/id_rsa"
It will prompt you for a passphrase, so enter it. You should see an Identity
message. Now, the agent knows the passphrase so that you will not be prompted to specify it anymore.
added
If you have multiple instances of command prompts, make sure that each command prompt has the appropriate SSH_AUTH_SOCK and SSH_AGENT_PID environment variables set. You can validate that this is working by running a command like ssh
and if you DO NOT get prompted for a passphrase, it is working!
-v git@github.com
Note that when you logoff, the ssh-agent will shut down and so when you log back in or restart your computer, you will need to repeat these steps. My understanding is that your passphrase is stored in memory, not persisted to disk, for security reasons.