Created
August 5, 2013 07:20
-
-
Save swpu-lee/6154032 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. 生成对应github账号的ssh-key(输入存储路径~/.ssh/github_rsa => 输入swpu-lee在github上的密码) | |
| ssh-keygen -t rsa -C "[email protected]" | |
| 2. 将公钥copy出来,贴到model-i-work账号上的SSH Keys中 | |
| pbcopy < ~/.ssh/id_rsa.pub | |
| https://github.com/settings/ssh | |
| 3. 测试是否连通了 | |
| ssh -T [email protected] | |
| 出现hello啥啥success就是ok了 | |
| 备注: | |
| 在centos_6.4_x64上没连成功,于是使用如下命令调试 | |
| ssh -vT [email protected] | |
| 发现是因为默认情况下,大多数服务器都只会寻找~/.ssh/id_rsa, ~/.ssh/id_dsa and ~/.ssh/identity这三个默认的key | |
| 如果我不覆盖这个的话,就需要使用ssh-add手动添加key到ssh的寻找路径中。于是运行如下命令: | |
| ssh-add ~/.ssh/github_rsa | |
| 提示:Could not open a connection to your authentication agent. | |
| 几经周折,发现解决方案: | |
| eval $(ssh-agent) | |
| ssh-add ~/.ssh/github_rsa | |
| 参考: | |
| https://help.github.com/articles/generating-ssh-keys | |
| https://help.github.com/articles/error-permission-denied-publickey | |
| http://unix.stackexchange.com/questions/12195/how-to-avoid-being-asked-passphrase-each-time-i-push-to-bitbucket |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment