在Linux上已经安装过git(自己搭建)了,本机(windows)想连接过去,通过git bash敲了下clone命令提示没权限:

$ git clone git@111.11.111.11:code.git
Cloning into 'code'...
The authenticity of host '111.11.111.11 (111.11.111.11)' can't be established.
ECDSA key fingerprint is SHA256:7jmL7Nrr9zJ7psJd3Zcfr4UckRNOMkgwK/ae9dsCgaw.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '111.11.111.11' (ECDSA) to the list of known hosts.
git@111.11.111.11's password:
Connection closed by 111.11.111.11 port
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists.

  第一次连接失败很正常,毕竟没有设置账号信息,但第二次连接敲了自己刚设置的密码,竟然一直提示没权限

$ git clone git@111.11.111.11:code.git
Cloning into 'code'...
git@111.11.111.11's password:
Permission denied, please try again.
git@111.11.111.11's password:
Permission denied, please try again.
git@111.11.111.11's password:
git@111.11.111.11: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,pas sword).
fatal: Could not read from remote repository. Please make sure you have the correct access rights
and the repository exists.

  蒙圈了,密码对的啊。看下日志:

$ ssh -vT git@111.11.111.11
OpenSSH_7.6p1, OpenSSL 1.0.2n Dec
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 111.11.111.11 [111.11.111.11] port .
debug1: Connection established.
debug1: identity file /c/Users/wulf/.ssh/id_rsa type
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_rsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_dsa type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_dsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ecdsa type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ecdsa-cert type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ed25519 type -
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ed25519-cert type -
debug1: Local version string SSH-2.0-OpenSSH_7.
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.
debug1: match: OpenSSH_7. pat OpenSSH* compat 0x04000000
debug1: Authenticating to 111.11.111.11: as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: aes128-ctr MAC: umac--etm@openssh.com comp ression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac--etm@openssh.com comp ression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:7jmL7Nrr9zJ7oooo5Zcfr4UckRNO MkgwK/ae9dsCgaw
debug1: Host '111.11.111.11' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/wulf/.ssh/known_hosts:
debug1: rekey after blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-,rsa-sha2->
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi c,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:gXnx5odooo7yK+Imse/ggjIzZdooooJwCU6T6PEy spk /c/Users/wulf/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi c,password
debug1: Trying private key: /c/Users/wulf/.ssh/id_dsa
debug1: Trying private key: /c/Users/wulf/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/wulf/.ssh/id_ed25519
debug1: Next authentication method: password

  然后又死循环了,让我输入密码。看日志里这个c/Users/wulf/.ssh目录下有啥东西,就发现原来这里有我的公钥:

$ cat /c/Users/wulf/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCf20s0rabgMRn8CCCCC/+VC/wS5x/dvIYoG+TP23bHWn9gD/AXizrkds5geX9AG90oVRqf+RfTvLFlaNMrzK

  公钥太长,上面就只是随便贴了点。后来才发现linux上的服务端git根本不认识你,因为你有的是你自己的密码,人家那还没有你的公钥呢,得去它那里设置一下。

  登陆linux下的111.11.111.11,把上面那段公钥贴到服务端authorized_keys里:

vi /home/git/.ssh/authorized_keys

  贴好后保存后再去windows的git bash本地连下,这次ok了:

$ git clone git@111.11.111.11:code.git
Cloning into 'code'...
warning: You appear to have cloned an empty repository.

git连接报错:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)的更多相关文章

  1. Visual Studio Code 使用 Git插件报错 - Permission denied (publickey)

    在使用GitHub的时候,为了避免每次输入用户名密码,都会使用SSH方式代替Https. 按网上教程,大多数使用SSH-KeyGen生成公私钥对,而后上传公钥至Github,并切换Repositori ...

  2. Mac ssh 连接报错 Permission denied (publickey)

    用的阿里云服务器,如果直接连接,会报下面错误: $ ssh root@47.94.132.115 Permission denied (publickey). 创建服务器的时候,连接秘钥会生成并下载到 ...

  3. IDEA中使用git报错Permission denied (publickey)

    最近在使用idea开发时,使用git拉取远程仓库的代码时,报错Permission denied (publickey),原因是因为ssh的密钥失效,必须得重新设置下ssh的密钥即可. 命令很简单,在 ...

  4. 解决方案 git@github.com出现Permission denied (publickey)

     ubentu 13.10 git version 1.8.3.2 解决方案:ssh -T git@github.com出现Permission denied (publickey).的问题 今天的任 ...

  5. 【转载】解决方案:git@github.com出现Permission denied (publickey)

    遇到的问题 今天心血来潮,想将intellij上的项目代码放到GitHub上管理. 在进行添加远程库的时候,出现了:git@github.com出现Permission denied (publick ...

  6. Git push提交时报错Permission denied(publickey)...Please make sure you have the correct access rights and the repository exists.

    一.git push origin master 时出错 错误信息为: Permission denied(publickey). fatal: Could not read from remote ...

  7. jenkins报错Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) 的处理

    问题背景:jenkins服务器发布代码后需要执行删除缓存的操作ssh -p222 eus_pe_devadmin@1.1.1.1 "sudo rm -rf /dev/shm/nginx/hi ...

  8. git push是报Permission denied (publickey)错误解决

    今天晕了半天了,搞了个git工程到github上,以为很简单,因为之前也弄过,那知道搞了大半天都搞不好,一直报如下错误 D:\javawork\ee-0.0.1-SNAPSHOT>git pus ...

  9. git@github.com出现Permission denied (publickey)

    上传项目的时候出现Permission denied (publickey)这个问题 解决方案如下: 看本地的.git/config设置的仓库url地址和github使用的链接地址是否一致如下图,如u ...

  10. ssh 密码连接报错 permission denied

    背景:ssh连接openstack  king时,出错permission denied (publickey,gssapi-keyex,gssapi-with-mic) 原因:king未开启ssh ...

随机推荐

  1. 20145221 《Java程序设计》第七周学习总结

    20145221 <Java程序设计>第七周学习总结 教材学习内容总结 第十二章部分 - Lambda 认识Lambda语法 Lambda去可以重复,符合DRY原则,而且Lambda表达式 ...

  2. POJ 1840 Eqs(乱搞)题解

    思路:这题好像以前有类似的讲过,我们把等式移一下,变成 -(a1*x1^3 + a2*x2^3)== a3*x3^3 + a4*x4^3 + a5*x5^3,那么我们只要先预处理求出左边的答案,然后再 ...

  3. about SpringBoot学习后记

    <SpringBoot实战>第一章节入门的名称为Spring风云再起 看起来Spring的功能确实受Java开发者喜爱 在SpringBoot中,继续将Spring框架做了另一次的封装使框 ...

  4. pix2pix-tensorflow搭建及其使用

    目录 pix2pix-tensorflow搭建过程 1. 环境搭建 2. 环境说明 3. 开始搭建 4. 训练结果说明 5. 数据集 5.1 图片格式说明 5.3 从先用图片创建图像对 5.4 如何进 ...

  5. nodejs使用multiparty模块实现文件上传(另附express.bodyParser()的说明)

    最近师弟师妹们在用formidable做文件上传的时候会出现form.parse()不会触发的问题,在stackoverflow也没有找到答案,反而是几个答案推荐使用multiparty来代替,因为那 ...

  6. 递归--练习8--noi1788Pell数列

    递归--练习8--noi1788Pell数列 一.心得 5 1. 6 //直接递归Time Limit Exceeded 7 //那就记忆化递归 8 2. 9 直接记忆化递归后还有问题 10 a[k] ...

  7. Object.assign()是浅拷贝

    浅拷贝: 复制的值指向同一个内存地址 深拷贝:复制的值指向新的内存地址 var a = { xm: { name: 'xiaoming' } } var b = Object.assign({}, a ...

  8. UVA-12166 Equilibrium Mobile(二叉树)

    题目大意:改变二叉树上的权值,使树平衡,问最少该几个值. 题目分析:不会做,查的题解.有条奇妙的性质:如果将第d层权值为w的节点为基准做改动,则整棵树的总重量为w<<d,即w*2^d.仔细 ...

  9. 自定义jQuery的animate动画

    //擦除效果 jQuery.extend(jQuery.easing, { easeOutBack : function(x, t, b, c, d, s) { s = s || 1.3; retur ...

  10. [转载]Morris Traversal方法遍历二叉树(非递归,不用栈,O(1)空间)

    本文主要解决一个问题,如何实现二叉树的前中后序遍历,有两个要求: 1. O(1)空间复杂度,即只能使用常数空间: 2. 二叉树的形状不能被破坏(中间过程允许改变其形状). 通常,实现二叉树的前序(pr ...