标签:
首先,先给服务器安装git
没什么好说的直接上 sudo apt-get install git
安装完想从我的github上把编写的代码放上去运行起来,发现问题不能从github的仓库里clone没权限
The authenticity of host ‘github.com (192.30.252.128)‘ 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 Warning: Permanently added ‘github.com,192.30.252.128‘ (RSA) to the list of known hosts. Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
我晕好吧忘了配置ssh 连接秘钥了。
生成SSH密钥过程:
1.查看是否已经有了ssh密钥:cd ~/.ssh
如果没有密钥则不会有此文件夹,有则备份删除
ubuntu@ip-172-31-30-72:~/workspace$ cd ~/.ssh ubuntu@ip-172-31-30-72:~/.ssh$ ll total 16 drwx------ 2 ubuntu ubuntu 4096 Aug 26 08:49 ./ drwxr-xr-x 5 ubuntu ubuntu 4096 Aug 26 08:46 ../ -rw------- 1 ubuntu ubuntu 388 Aug 26 07:29 authorized_keys -rw-r--r-- 1 ubuntu ubuntu 884 Aug 26 08:49 known_hosts
2.2.生存密钥:
ssh-keygen -t rsa -C "870736375@qq.com"
按3个回车,密码为空。
Generating public/private rsa key pair. Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/ubuntu/.ssh/id_rsa. Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub. The key fingerprint is: a0:a0:f1:d1:ea:da:05:56:72:00:f8:91:0c:7b:0b:35 870736375@qq.com The key‘s randomart image is: +--[ RSA 2048]----+ |++E. | |.o++ | |+.=.+ . | | *.O . . | |. * . S | | o . | | . . | | o . | |. . | +-----------------+
3.在github上添加ssh密钥,这要添加的是“id_rsa.pub”里面的公钥。
添加进去然后ok 已经和github关联好了开心了。
下一篇:关于微信公众账号nodejs开发
标签:
原文地址:http://my.oschina.net/chinacaptain/blog/497422