git连接报错:Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)

  在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 ‘116.62.136.56‘ (ECDSA) to the list of known hosts.
git@111.11.111.11‘s password:
Connection closed by 111.11.111.11 port 22
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  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 111.11.111.11 [111.11.111.11] port 22.
debug1: Connection established.
debug1: identity file /c/Users/wulf/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/wulf/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 111.11.111.11:22 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-64-etm@openssh.com comp                                                                                                                ression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-64-etm@openssh.com comp                                                                                                                ression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:7jmL7Nrr9zJ7psJd3Zcfr4UckRNO                                                                                                                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:14
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
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:gXnx5odoFP7yK+Imse/ggjIzZdFZBmJwCU6T6PEy                                                                                                                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

  接着看一下我的公钥:

$ 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

  保存后再去本地连下,ok了:

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

---恢复内容结束---

原文地址:https://www.cnblogs.com/wuxun1997/p/10538662.html

时间: 2024-10-03 10:00:09

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

git clone时报错Permission denied (publickey)

一.使用ssh方式从github上git clone时报错Permission denied (publickey)解决方法:1.ssh-keygen -t rsa 该命令产生一个公钥文件和一个私钥文件,centos系统下默认放在~/.ssh/目录下 2.将公钥文件id_isa.pub里面的文件复制到github设置ssh key的地方 3.此时git clone应该就会成功了 4.如果还不行,试试以下命令,告诉系统去哪里找私钥eval 'ssh-agent'ssh-agent ~/.ssh/i

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

在使用GitHub的时候,为了避免每次输入用户名密码,都会使用SSH方式代替Https. 按网上教程,大多数使用SSH-KeyGen生成公私钥对,而后上传公钥至Github,并切换Repositorie为SSH. 使用SSH-KeyGen输出如下: Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ss

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

问题背景:jenkins服务器发布代码后需要执行删除缓存的操作ssh -p222 [email protected] "sudo rm -rf /dev/shm/nginx/hipdf/cache/*" 分析:要让jenkins能删除远程服务器上的缓存,需要配置免秘钥打通为避免权限过大,使用 eus_pe_devadmin 操作,即jenkins服务器上运行tomcat服务的apache用户操作远程 eus_pe_devadmin 用户来删除缓存需要把运行jenkins程序的apach

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

今天晕了半天了,搞了个git工程到github上,以为很简单,因为之前也弄过,那知道搞了大半天都搞不好,一直报如下错误 D:\javawork\ee-0.0.1-SNAPSHOT>git push -u origin masterWarning: Permanently added the RSA host key for IP address '192.30.252.130' to the list of known hosts.Permission denied (publickey).fa

git push时出现Permission denied(publickey)的解决

1 问题描述 push的时候出现上述错误,它说请确保有足够的权限和这个仓库存在,仓库不存在...这个估计不是,所以是权限的问题,准确来说是sshkey的问题. 2 重新生成ssh key ssh-key -t rsa -b 4096 -C [email protected] 这是gitub推荐的生成新ssh key的方法.注意,请不要使用默认的名字,第一个就会提示输入名字,请使用自定义的名字. 3 修改~/.ssh/config 移动公钥和私钥到~/.ssh下. mv xxx xxx.pub ~

git clone gi[email&#160;protected]:xxx.git Permission denied (publickey) 问题解决办法

本文主要解决一个问题 git clone 出现公共密钥的权限问题.症状如下: CasondeMacBook-Pro:devops cason$ git clone [email protected]:360yyou/yyou.gitCloning into 'yyou'...Permission denied (publickey).fatal: Could not read from remote repository. Please make sure you have the correc

git 时 出现 Permission denied (publickey).

https://blog.csdn.net/awp0011/article/details/73368481 第一次使用github.com在本地 执行 git clone [email protected]:xxxxx/xxxxx.git 异常信息: Permission denied (publickey). fatal: Could not read from remote repository. 原因是SSH 登录时没有加密所需的秘钥 所以 我们 需要生成密码 ssh-keygen -t

My solution for Git Client Error: Permission denied (publickey)

在使用Git客户端的过程中遇到的问题以及解决方案分享. 我之前已经安装Git客户端并且使用Git开发过公司项目,也已经正确生成PublicKey并且添加到SSH keys on github of my account,但是当我想从github上克隆另一个客户端push的代码的时候一直报错: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have

ssh 协议执行repo sync 报错:Permission denied (publickey)

1.ssh key 已经添加ssh key到gerrit服务器,并且执行ssh协议的git clone可以正常克隆代码到本地,可见不是ssh key的问题. 2.manifest清单文件配置 最初在manifest清单文件中配置: <remote name="origin" fetch="ssh://[email protected]:29418"/> 或者: <remote name="origin" fetch="