创建SSH Key
ssh-keygen -t rsa -C "youremail@example.com"
在生成SSH Key时,如果不小心设置了passphrase,使用SSH协议克隆远程仓库时,在每次git pull和git push时都会提示Enter passphrase for key '/Users/zhangxiaoxue/.ssh/id_rsa'
,每次都要手动输入密码才能继续操作,可以在命令行输入sh-keygen -p
进行重新设置,直接回车输入为空,就没有密码了。
zhangxiaoxue@MacBook-Pro learn-git % ssh-keygen -p
Enter file in which the key is (/Users/zhangxiaoxue/.ssh/id_rsa):
Enter old passphrase:
Key has comment 'sybil3904@163.com'
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.