SSH方式登录github出现Permission denied (publickey)
今天在公司上传了代码,回到家pull,结果竟然出现了“Permission denied (publickey)“这种东西。第一反应是key不对,可是上次明明用key登录过,不可能不对啊,难道是文件被删除或覆盖?赶紧ls .ssh瞅一眼,发现上次生成的git、git.pub文件好好的在那呢。再想想,我也没动过github上的key设置啊,在公司都是https方式push的呢。确认不是key的设置问题,在http://henzil.easymorse.com/?p=508找到了解决方案。
下面记录一下解决过程:
x*z@x*z-HP-ProBook-4446s:~/code/game_server$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists.
x*z@x*z-HP-ProBook-4446s:~/code/game_server$ ^C
x*z@x*z-HP-ProBook-4446s:~/code/game_server$ ssh -T git@github.com
Permission denied (publickey).
x*z@x*z-HP-ProBook-4446s:~/code/game_server$ ls .ssh
ls: 无法访问.ssh: 没有那个文件或目录
x*z@x*z-HP-ProBook-4446s:~/code/game_server$ cd ~
x*z@x*z-HP-ProBook-4446s:~$ ls .ssh
git git.pub Identity Identity.pub known_hosts
x*z@x*z-HP-ProBook-4446s:~$ ssh -vT git@github.com
OpenSSH_6.6.1, OpenSSL 1.0.1f Jan
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line : Applying options for *
debug1: Connecting to github.com [192.30.252.130] port .
debug1: Connection established.
debug1: identity file /home/x*z/.ssh/id_rsa type -
debug1: identity file /home/x*z/.ssh/id_rsa-cert type -
debug1: identity file /home/x*z/.ssh/id_dsa type -
debug1: identity file /home/x*z/.ssh/id_dsa-cert type -
debug1: identity file /home/x*z/.ssh/id_ecdsa type -
debug1: identity file /home/x*z/.ssh/id_ecdsa-cert type -
debug1: identity file /home/x*z/.ssh/id_ed25519 type -
debug1: identity file /home/x*z/.ssh/id_ed25519-cert type -
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6..1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version libssh-0.6.
debug1: no match: libssh-0.6.
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA ::ac:a5:::2d:::1b::4d:eb:df:a6:
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/x*z/.ssh/known_hosts:
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/x*z/.ssh/id_rsa
debug1: Trying private key: /home/x*z/.ssh/id_dsa
debug1: Trying private key: /home/x*z/.ssh/id_ecdsa
debug1: Trying private key: /home/x*z/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
x*z@x*z-HP-ProBook-4446s:~$ ssh-add .ssh/git
git git.pub
x*z@x*z-HP-ProBook-4446s:~$ ssh-add .ssh/git
Identity added: .ssh/git (.ssh/git)
x*z@x*z-HP-ProBook-4446s:~$ ssh-add .ssh/git.pub
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for '.ssh/git.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
x*z@x*z-HP-ProBook-4446s:~/code/game_server$ git pull
remote: Counting objects: , done.
remote: Compressing objects: % (/), done.
remote: Total (delta ), reused (delta )
Unpacking objects: % (/), done.
来自 github.com:changnet/game_server
d12f07e..72ef640 master -> game_server/master
更新 d12f07e..72ef640
Fast-forward
common/CLogFile.cpp | +++++++++++++++++++++++++++++++++++++++++++++++++++++
common/CLogFile.h | ++++++++++++++++++++++++++
files changed, insertions(+)
create mode common/CLogFile.cpp
create mode common/CLogFile.h
x*z@x*z-HP-ProBook-4446s:~/code/game_server$
PS:ssh-add指令我也不是很熟悉,上面尝试添加public key时的警告请大家再查资料了。有时候.ssh目录下的key太多,可能会导致ssh登录不上,这时需要写ssh配置文件解决。
SSH方式登录github出现Permission denied (publickey)的更多相关文章
- SSH Key连接github提示Permission denied (publickey).错误
root@debian64:/home/xiaoliuzi/.ssh/key_backup# ssh -T git@github.com The authenticity of host 'githu ...
- $ ssh -T -v git@github.com_在本地用ssh连接github出错_git@github.com: Permission denied (publickey).
$ ssh -T -v git@github.com报错: debug1: Authentications that can continue: publickey debug1: Next auth ...
- github:当你想要使用VSCODE开心提交代码时,出现Git:git@github.com:Permission denied(publickey)解决方案
当你想要使用VSCODE开心提交代码时,出现Git:git@github.com:Permission denied(publickey)弹框 图片: 原因:电脑公钥(publickey)未添加至gi ...
- git克隆出错 github clone Permission denied (publickey) fatal Could not read from remote repo
原文网址:http://blog.csdn.net/feeling450/article/details/53067563 github clone "Permission denied ( ...
- 使用Git出现以下错误"Git@github.com: Permission denied (publickey). Could not read from remote repository."解决方案
转载于:https://blog.csdn.net/dotphoenix/article/details/100130424 git@github.com: Permission denied (pu ...
- git实战中遇到git@github.com: Permission denied (publickey).的问题
一.问题我们在使用git的时候会建立一个私钥和一个公钥来完成彼此的通讯,因此如何使用给一个指令建立一个秘钥至关重要.但是我在实践的过程中出现了git@github.com: Permission de ...
- git@github.com: Permission denied (publickey).////remote: Permission to xxx/test.git denied to xxx.等权限问题
Error msg git@github.com: Permission denied (publickey) 或者: remote: Permission to xxx/test.git denie ...
- [置顶] github 出现 Permission denied (publickey)的解决
今天写了一篇博客,想push到github上的时候出现了以下错误 Permission denied (publickey). fatal: The remote end hung up unexpe ...
- clone github报Permission denied (publickey) 解决方案
问题描述 问题产生的原因,不是很清楚,就不管了.在执行git clone git@github.com:****.git 的时候报了Permission denied (publickey). War ...
随机推荐
- python标准库之字符编码详解
codesc官方地址:https://docs.python.org/2/library/codecs.html 相关帮助:http://www.cnblogs.com/huxi/archive/20 ...
- 布局神器:Flexbox
最近的工作内容大多是移动端网页的开发,百分比布局,Media Queries,Bootstrap等常规的响应式/自适应的开发技术皆一一试过,但觉以上都不够灵活,所以,一直再尝试寻求更加灵活的精确的移动 ...
- first day for new job
第一天上班,做个总结. 总得来说,感觉非常不错,一个结论~保持头脑清醒,好好加油. 今天主要办一些入职手续,拿到了代码,后面几天主要就是熟悉应用的功能.源代码.想好好制定个计划,定日目标. 1.功能结 ...
- 502 bad gateway是什么意思
通俗解释一下 1.什么是502 bad gateway 报错? 简单来说 502 是报错类型代码 bad gateway 错误的网关 2.产生错误的原因 连接超时 我们向server器发送请求 因为s ...
- DB2数据库全系列版本安装介质下载地址
网盘:http://pan.baidu.com/s/1qWE4D7A? ... qq-pf-to=pcqq.group官方:http://www-01.ibm.com/support/docview. ...
- java基础之数组
数组的定义 数组的应用 1, 2, 3, 4,
- Java数据结构漫谈-ArrayList
ArrayList是一个基于数组实现的链表(List),这一点可以从源码中看出: transient Object[] elementData; // non-private to simplify ...
- C#不用COM组件导出数据到Excel中
<?xml version='1.0'?><?mso-application progid='Excel.Sheet'?><Workbook xmlns='urn:sch ...
- OpenGL ES 2.0 内置变量
1. 顶点着色器中的内置变量 输出变量 gl_Position(vec4):顶点数据位置gl_PointSize(float):计算一个点的大小 2.片元着色器中的内置变量 输入变量gl_FragCo ...
- 【3】创建一个简单的Laravel例子
现在我们来创建一个Laravel的例子来帮助理解 1.首先打开app/Http/routes.php文件,在里边写上一条路由: 2.创建一个控制器,有两种方法 ①在app/Http/Controlle ...