首页 新闻 会员 周边

gitlab上传公钥ssh方式为何还认证不了!!!

0
悬赏园豆:10 [待解决问题]

在本地虚拟机做实验搭建一个jitlab服务,公钥已经上传却clone不了项目。
用ssh测试也证明认证有问题,下面是日志但是还是看不懂哪里有问题。
[root@localhost test]# ssh -vT git@192.168.56.137 -p 22
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for
debug1: Connecting to 192.168.56.137 [192.168.56.137] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH
compat 0x04000000
debug1: Authenticating to 192.168.56.137: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: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ju5TnIrVbTWdlRmkolPOiT8LJx8j8DGMKEO1jKRhHUQ
debug1: Host '192.168.56.137' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 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-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:0)

debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: KEYRING:persistent:0)

debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Next authentication method: password
git@192.168.56.137's password:

aptxhb的主页 aptxhb | 初学一级 | 园豆:192
提问于:2020-03-02 16:23
< >
分享
所有回答(2)
1

生成key: ssh-keygen -t rsa,查看生成的id_rsa.pub文件内容,在你的gitlab 设置里 ssh设置里 添加id_rsa.pub文件内容,测试ssh连接是否通 ,第一次时候会提示是否continue,输入yes后程序会自动连接,试试吧

风行天下12 | 园豆:3867 (老鸟四级) | 2020-03-02 16:31
0

你这个就是ssh版本过高,导致rsa认证被拒绝,加上这个验证方式即可。下面是两个操作系统的解决方式,你按着加一下试试。

linux:

  1. vim /etc/ssh/ssh_config
    添加以下内容:
    Host *
    HostkeyAlgorithms +ssh-rsa
    PubkeyAcceptedKeyTypes +ssh-rsa

windows:
1.在.ssh文件夹中创建config
添加以下内容:
Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

晚风吹散了你 | 园豆:202 (菜鸟二级) | 2022-03-08 19:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册