Gitlab no matching host key type found. Their offer: ssh-rsa,ssh-dss

错误


  • 具体提示如下

    haifeng.gao@XMITDN0504240 MINGW64 ~/salt-nginx-uat (master)
    $ git push && git push uatdev master
    Everything up-to-date
    Unable to negotiate with 61.172.194.131 port 55555: no matching host key type found. Their offer: ssh-rsa,ssh-dss
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.

解决方法


如果是Windows,参考以下步骤

  1. 修改ssh_config配置文件C:\Program Files\Git\etc\ssh

    #    $OpenBSD: ssh_config,v 1.35 2020/07/17 03:43:42 dtucker Exp $
    
    # This is the ssh client system-wide configuration file.  See
    # ssh_config(5) for more information.  This file provides defaults for
    # users, and the values can be changed in per-user configuration files
    # or on the command line.
    
    # Configuration data is parsed as follows:
    #  1. command line options
    #  2. user-specific file
    #  3. system-wide file
    # Any configuration value is only changed the first time it is set.
    # Thus, host-specific definitions should be at the beginning of the
    # configuration file, and defaults at the end.
    
    # Site-wide defaults for some commonly used options.  For a comprehensive
    # list of available options, their meanings and defaults, please see the
    # ssh_config(5) man page.
    
    # Host *
    #   ForwardAgent no
    #   ForwardX11 no
    #   PasswordAuthentication yes
    #   HostbasedAuthentication no
    #   GSSAPIAuthentication no
    #   GSSAPIDelegateCredentials no
    #   BatchMode no
    #   CheckHostIP yes
    #   AddressFamily any
    #   ConnectTimeout 0
    #   StrictHostKeyChecking ask
    #   IdentityFile ~/.ssh/id_rsa
    #   IdentityFile ~/.ssh/id_dsa
    #   IdentityFile ~/.ssh/id_ecdsa
    #   IdentityFile ~/.ssh/id_ed25519
    #   Port 22
    #   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
    #   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
    #   EscapeChar ~
    #   Tunnel no
    #   TunnelDevice any:any
    #   PermitLocalCommand no
    #   VisualHostKey no
    #   ProxyCommand ssh -q -W %h:%p gateway.example.com
    #   RekeyLimit 1G 1h
    #   UserKnownHostsFile ~/.ssh/known_hosts.d/%k
    # Added by git-extra
    Host ssh.dev.azure.com
        HostkeyAlgorithms +ssh-rsa
        PubkeyAcceptedAlgorithms +ssh-rsa
    # Added by git-extra
    Host *.visualstudio.com
        HostkeyAlgorithms +ssh-rsa
        PubkeyAcceptedAlgorithms +ssh-rsa
    ## 新增配置
    Host gitlab.ximalaya.com
        KexAlgorithms +diffie-hellman-group1-sha1
        HostkeyAlgorithms +ssh-rsa
        PubkeyAcceptedAlgorithms +ssh-rsa
  2. 在C:\Users\haifeng.gao\.ssh下新增config文件,如下

    其中IdentityFile指向的是你当时生成的密钥位置

    Host *
    IdentityFile C:\Users\haifeng.gao\.ssh\id_rsa
    HostKeyAlgorithms ssh-rsa
    PubkeyAcceptedKeyTypes ssh-rsa

     

     

posted @ 2022-07-06 19:51  MacoPlus  阅读(1338)  评论(0编辑  收藏  举报