Skip to content

Instantly share code, notes, and snippets.

@swpu-lee
Created August 5, 2013 07:20
Show Gist options
  • Save swpu-lee/6154032 to your computer and use it in GitHub Desktop.
Save swpu-lee/6154032 to your computer and use it in GitHub Desktop.
1. 生成对应github账号的ssh-key(输入存储路径~/.ssh/github_rsa => 输入swpu-lee在github上的密码)
ssh-keygen -t rsa -C "swpu-lee@github.com"
2. 将公钥copy出来,贴到model-i-work账号上的SSH Keys中
pbcopy < ~/.ssh/id_rsa.pub
https://github.com/settings/ssh
3. 测试是否连通了
ssh -T git@github.com
出现hello啥啥success就是ok了
备注:
在centos_6.4_x64上没连成功,于是使用如下命令调试
ssh -vT git@github.com
发现是因为默认情况下,大多数服务器都只会寻找~/.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