GitHub_SSH帮助文件

检查已存在的Key

$ ls -al ~/.ssh

生成一个新的SSH Key

  1. 生成

    $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    
  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/id_rsa.pub
    
  2. Setting/SSH and GPG keys/New SSH key

测试SSH连接

  1. 测试

    ssh -T git@github.com
    
  2. 确认指纹

    The authenticity of host 'github.com (192.30.252.1)' 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.