$ ls -al ~/.ssh

生成一个新的SSH Key

  1. 生成

    $ ssh-keygen -t rsa -b 4096 -C ""
  2. 输入文件路径

    Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
  3. 输入密码

    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]

添加SSH key到ssh-agent

  1. 确保ssh-agent可用

    $ eval "$(ssh-agent -s)"
  2. 添加SSH key到ssh-agent

    $ ssh-add ~/.ssh/id_rsa

将SSH key添加到GitHub账号

  1. 复制key

    $ pbcopy < ~/.ssh/
  2. Setting/SSH and GPG keys/New SSH key


  1. 测试

    ssh -T
  2. 确认指纹

    The authenticity of host ' (' can't be established.
    RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
    Are you sure you want to continue connecting (yes/no)?
  3. 大功告成

    Hi username! You've successfully authenticated, but GitHub does not
    provide shell access.