首先要在GitHub上创建一个帐号,因为本地Git仓库和GitHub仓库之间的传输是通过SSH加密的,所以要在本地生成一个私钥和一个密钥
命令,后面跟的邮箱。要跟你自己的;增加输出的位置;能够不用设置password一路按回车即可了
//lindeMac-mini:~ a123$ ssh-keygen -C 'yourEmail' -t rsa lindeMac-mini:~ a123$ ssh-keygen -C '412695816@qq.com' -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/Users/a123/.ssh/id_rsa): /Users/a123/Desktop/QY Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/a123/Desktop/QY . Your public key has been saved in /Users/a123/Desktop/QY .pub. The key fingerprint is: 93:84:b7:37:eb:2f:71:78:02:3c:66:e7:c4:9f:dd:0e 412695816@qq.com The key's randomart image is: +--[ RSA 2048]----+ | | | . | | ..o. | | o*o+ | | oS*oo o . | | o=o= E .| | .= o | | .. .| | .o. | +-----------------+在桌面就可以看到两个文件QY是私钥, QY.pub是密钥
打开QY.pub文件(能够用Xcode打开),复制里面的内容粘贴到GitHub指定的位置,按下面步骤能够加入一个公钥
title的名字能够任意写