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 "[email protected]"
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): (empty)
Enter same passphrase again: (empty)
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 [email protected]
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 [email protected]

Hi feuyeux! You've successfully authenticated, but GitHub does not provide shell access.

如果没有直接通过,出现如下信息,输入yes

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,207.97.227.239' (RSA) to the list of known hosts.

Hi feuyeux! You've successfully authenticated, but GitHub does not provide shell access.

 

参考:

Mac下SSH的配置 http://help.github.com/mac-set-up-git

 

windows下SSH的配置 http://help.github.com/win-set-up-git

 

Linux下SSH的配置 http://help.github.com/linux-set-up-git

你可能感兴趣的:(github,linux,git,mac)