centos - git clone提示输入密码,公钥无效,在线急等高手解答

浏览:38日期:2023-10-27

问题描述

环境:阿里云Centos 6.5,客户端msysgit最新版。主要参考文章:http://freeloda.blog.51cto.com/2033581/1410562遇到问题参考的链接,/q/1010000000445726问题依旧。问题:公钥已配置,且已拷贝到正确目录。git clone时提示输入密码。万分着急。希望高手帮帮忙!!!

$ git clone git@42.96.xxx.xxx:/opt/data/git/zebenrepos.git

应要求,上msysgit 命令行使用ssh -vvv模式抓取的日志:

第一段:

zxl@ZXL-THINK /c$ ssh -vvv git@42.96.1xx.2xx

第二段:

debug2: key: /c/Users/zxl/.ssh/id_ecdsa (0x0),debug2: key: /c/Users/zxl/.ssh/id_ed25519 (0x0),debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,passworddebug3: preferred publickey,keyboard-interactive,passworddebug3: authmethod_lookup publickeydebug3: remaining preferred: keyboard-interactive,passworddebug3: authmethod_is_enabled publickeydebug1: Next authentication method: publickeydebug1: Offering RSA public key: /c/Users/zxl/.ssh/id_rsadebug3: send_pubkey_testdebug2: we sent a publickey packet, wait for replydebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Trying private key: /c/Users/zxl/.ssh/id_dsadebug3: no such identity: /c/Users/zxl/.ssh/id_dsa: No such file or directorydebug1: Trying private key: /c/Users/zxl/.ssh/id_ecdsadebug3: no such identity: /c/Users/zxl/.ssh/id_ecdsa: No such file or directorydebug1: Trying private key: /c/Users/zxl/.ssh/id_ed25519debug3: no such identity: /c/Users/zxl/.ssh/id_ed25519: No such file or directorydebug2: we did not send a packet, disable method

第二段中怀疑没有尝试rsa,故第三段换了dsa

第三段

debug1: Next authentication method: publickeydebug1: Trying private key: /c/Users/zxl/.ssh/id_rsadebug3: no such identity: /c/Users/zxl/.ssh/id_rsa: No such file or directorydebug1: Offering DSA public key: /c/Users/zxl/.ssh/id_dsadebug3: send_pubkey_testdebug2: we sent a publickey packet, wait for replydebug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,passworddebug1: Trying private key: /c/Users/zxl/.ssh/id_ecdsadebug3: no such identity: /c/Users/zxl/.ssh/id_ecdsa: No such file or directorydebug1: Trying private key: /c/Users/zxl/.ssh/id_ed25519debug3: no such identity: /c/Users/zxl/.ssh/id_ed25519: No such file or directorydebug2: we did not send a packet, disable methoddebug3: authmethod_lookup passworddebug3: remaining preferred: ,passworddebug3: authmethod_is_enabled passworddebug1: Next authentication method: passwordgit@42.96.1xx.2xx’s password:

看看这日志,实在没搞懂,为什么dsa已经试通了,还去输入密码?

问题解答

回答1:

总结一下:(1)、Centos下,此问题出现与s_home_t的目录标签无很大关系,与SELinux也没有很大关系。本人机器.ssh根本就没有标签,也没修改selinux配置。 (2)、参考网上的教程要十分小心。初步分析问题出现在编辑/etc/passwd中禁用git ssh访问:

git:x:500:500::/home/git:/bin/bash ##此行注释掉git:x:500:500:git version control:/home/git:/usr/bin/git-shell

注意:下面一行的两个数字(应该是UID吧),一定要跟原来的(上面一行注释掉的)一样。如果粗心大意,怎么也想不到问题出在这里!

回答2:

你可能clone的是https链接的repo,试试clone ssh链接的repo吧,一般会有两个链接的。我遇到过这个问题,是这样解决的。centos - git clone提示输入密码,公钥无效,在线急等高手解答

回答3:

把你 git clone 的后续命令给出来

回答4:

这个根本没法帮你,不知道更多的信息

相关文章: