centos - git clone提示輸入密碼,公鑰無效,線上急等高手解答
怪我咯
怪我咯 2017-04-26 09:01:56
0
4
853

環境:阿里雲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-mi
c,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-m
ic,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /c/Users/zxl/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi
c,password
debug1: Trying private key: /c/Users/zxl/.ssh/id_dsa
debug3: no such identity: /c/Users/zxl/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /c/Users/zxl/.ssh/id_ecdsa
debug3: no such identity: /c/Users/zxl/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /c/Users/zxl/.ssh/id_ed25519
debug3: no such identity: /c/Users/zxl/.ssh/id_ed25519: No such file or director
y
debug2: we did not send a packet, disable method

第二段中懷疑沒有嘗試rsa,故第三段換了dsa

第三段

debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/zxl/.ssh/id_rsa
debug3: no such identity: /c/Users/zxl/.ssh/id_rsa: No such file or directory
debug1: Offering DSA public key: /c/Users/zxl/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mi
c,password
debug1: Trying private key: /c/Users/zxl/.ssh/id_ecdsa
debug3: no such identity: /c/Users/zxl/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /c/Users/zxl/.ssh/id_ed25519
debug3: no such identity: /c/Users/zxl/.ssh/id_ed25519: No such file or director
y
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
git@42.96.1xx.2xx's password:

看看這日誌,實在沒搞懂,為什麼dsa已經試通了,還去輸入密碼?

怪我咯
怪我咯

走同样的路,发现不同的人生

全部回覆(4)
黄舟

總結一下:(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吧),一定要跟原來的(上面一行註解掉的)一樣。如果粗心大意,怎麼也想不到問題出在這裡!

漂亮男人

你可能clone的是https連結的repo,試試clone ssh連結的repo吧,通常會有兩個連結的。
我遇到過這個問題,是這樣解決的。

淡淡烟草味

把你 git clone 的後續指令給出來

迷茫

這個根本沒辦法幫你,不知道更多的資訊

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!