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 ...
随机推荐
- spark1.3的部署
1.下载源码,根据自己的环境编译,我这里下载的是spark1.3版本 本人采用sbt编译, SPARK_HADOOP_VERSION=2.5.2 SPARK_YARN=ture sbt/sbt ass ...
- zoj 3547 The Boss on Mars
需要用到概率论的容斥定理以及计算1 ^ 4 + 2 ^ 4 + ……+ n ^ 4的计算公式1^4+2^4+……+n^4=n(n+1)(2n+1)(3n^2+3n-1)/30 #pragma comm ...
- Qt 图形特效(Graphics Effect)介绍
原文链接:Qt 图形特效(Graphics Effect)介绍 QGraphicsEffect也是Qt-4.6引入的一个新功能.它让给图形元素QGraphicsItem增加更佳视觉效果的编程变得非常简 ...
- C# XML,XmlDocument简单操作实例
private static string _Store = LocalPathHelper.CurrentSolutionPath + "/data/bookstore.xml" ...
- (转) 值不能为空。参数名viewinfo(microsoft.sqlserver.management.sqlstudio.explorer)
打开MSSQL 2008 R2的时候,展开数据库都显示以下的错误提示: 值不能为空.参数名viewinfo(microsoft.sqlserver.management.sqlstudio.explo ...
- (转)IIS5.1的安装配置并发布ASP.NET网站
最近跟老师做一个桥梁养护系统的项目,要求用VS2008+Sql Server2000,服务器用IIS.由于之前做过的ASP.NET项目都是用的VS内置的服务器,并没有使用过IIS,第一次搭,花了几个小 ...
- 数据库分库分表(sharding)系列(五) 一种支持自由规划无须数据迁移和修改路由代码的Sharding扩容方案
作为一种数据存储层面上的水平伸缩解决方案,数据库Sharding技术由来已久,很多海量数据系统在其发展演进的历程中都曾经历过分库分表的Sharding改造阶段.简单地说,Sharding就是将原来单一 ...
- (原)torch中显示nn.Sequential()网络的详细情况
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6065526.html 本部分多试几次就可以弄得清每一层具体怎么访问了. step1. 网络定义如下: ...
- No2_4.接口继承多态_Java学习笔记_经典案例
import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; import jav ...
- sudo 无法解析主机的解决办法
错误存在于更改主机名字后,解决办法如下: sudo gedit /etc/hosts找到如下行:127.0.1.1 XXX将其修改为:127.0.1.1 (你现在的主机名) 保 ...