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): (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 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.

如果没有直接通过,出现如下信息,输入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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值