问题
I'm trying to setup a GitHub account and every time I get to the point of entering a passphrase for my SSH key my terminal freezes. Here are my steps:
Parkers-MacBook-Pro:~ ppreyer$ ssh-keygen -t rsa -C Parker.preyer1@gmail.com Generating public/private rsa key pair. Enter file in which to save the key (/Users/ppreyer/.ssh/id_rsa): (/Users/ppreyer/.ssh/id_rsa): Created directory '/Users/ppreyer/.ssh'. Enter passphrase (empty for no passphrase): (WONT LET ME TYPE ANYTHING)
Anybody else run into this problem?
回答1:
You're on a unix compliant machine. Therefore, most terminal-based password entry mechanisms use what's called a "Unix password field" (as far as I know, that's the most common name for it). You do not actually see the characters you are typing, but they are there. Simply make sure you type the same thing twice and you should be good.
Give it a try, type your password and press Enter. Type it again and press Enter again. You've just create an SSH passphrase.
回答2:
I agree with MaxMackie's answer (upvoted), but I also like to generate my ssh keys non-interactively:
[space]ssh-keygen -t rsa -f "${H}/.ssh/myKey" -C "Gitolite Admin access (not interactive)" -q -P "xxxx"
That generates a 'mykey
' private ssh key and a 'mykey.pub
' public ssh key in my ~/.ssh
directory.
Note the space before the command, in order to avoid, in my bash session, to record that command in the bash history (because I have defined a HISTCONTROL=ignorespace
as in "Execute a terminal command without saving it to .bash_history on OS X?")
来源:https://stackoverflow.com/questions/10890435/creating-a-passphrase-for-my-ssh-key-on-github