前提:得先注册一个账号
(1)建立远程仓库
首先在浏览器中输入网址https://github.com
先创建一个仓库
添加key:单击右上角自己的头像,在下拉菜单中选择“settings”选项
在跳转的页面中左侧菜单栏选择SSH and GPG keys,右侧单击“New SSH key”按钮,把Linux机器上的~/.ssh/id_rsa.pub内容粘贴到这里
密钥生成:
[root@fengxi gitroot]# ssh-keygen //用ssh生成密钥,一直按回车
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
66:9d:ee:b4:9a:27:f3:4d:2b:fa:a1:ea:17:d4:d9:5e root@fengxi
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . o |