創建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.