gitHub的SSH配置
git push 时遇权限问题:
bogon:jsfrf han$ git push
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
解决办法如下:
1.进入ssh目录并检查
bogon:jsfrf han$ cd ~/.ssh
bogon:.ssh han$ ls
2.备份
bogon:.ssh han$ mkdir key_backup
bogon:.ssh han$ cp id_rsa* key_backup
cp: id_rsa*: No such file or directory
bogon:.ssh han$ rm id_rsa*
rm: id_rsa*: No such file or directory
3.生成公钥私钥对
bogon:.ssh han$ ssh-keygen -t rsa -C "feuyeux@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/han/.ssh/id_rsa): id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
38:a7:c3:d3:20:e6:16:04:1e:02:1b:4e:26:d8:27:2e feuyeux@gmail.com
The key's randomart image is:
+--[ RSA 2048]----+
|B+o |
|*=oo. |
|.o.o. |
|E .. . |
| . + + S |
| o + * |
| o = . |
| . o |
| |
+-----------------+
4.上传公钥到
https://github.com/account/ssh
Account Settings > 点击 SSH Public Keys > 点击 “Add another public key”
5.测试结果
bogon:.ssh han$ ssh -T git@github.com
Hi feuyeux! You've successfully authenticated, but GitHub does not provide shell access.
参考:
Linux下SSH的配置
http://help.github.com/linux-set-up-git/
Mac下SSH的配置
http://help.github.com/mac-set-up-git/
http://www.linuxso.com/linuxpeixun/14406.html