本文共 630 字,大约阅读时间需要 2 分钟。
1、先安装ssh,一条命令搞定
$ sudo apt-get install openssh-server
2、生成秘钥
$ ssh-keygen -t rsa -C "your email" 若不需要密码,连续三次回车,在~/.ssh/目录下得到两个文件:id_rsa和id_rsa.pub。
3、登陆Github,将id_rsa.pub中的公钥内容全部复制到github上。
点击右上角账号头像的“▼”→Settings→SSH kyes→Add SSH key。
4、测试
$ ssh -T git@github.com
你将会看到
The authenticity of host 'github.com (207.97.227.239)' 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)?
选择 yes后,出现
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
如果看到Hi后面是你的用户名,说明设置成功了。
5、添加远程仓库的ssh路径$ git remote add ssh路径
转载地址:http://abfnb.baihongyu.com/