Github指定本地私钥访问仓库
一共有三个关键步骤:
- 生成新的私钥
- 上传公钥到github
- 修改本地ssh配置
Mac pro迁移后,本地的 github 私钥忘记是哪个,重新生成一个新的私钥放在一个新目录。(怕覆盖了原来的私钥,其他应用受影响)
1. 生成新的私钥
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/<default>/.ssh/id_rsa): <your new path>/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in <your new path>/id_rsa.
Your public key has been saved in <your new path>/id_rsa.pub.
The key fingerprint is:
... ...
注意指定一个新的目录 <your new path>
2. 上传公钥到github
打开公钥内容,如下: