遇到的问题:
openSSH版本太高,openssh高版本默认禁止ssh-rsa加密算法,直接换ed25519
执行以下命令:
在.ssh目录下执行:ssh-keygen -t ed25519 -C “youremail.com”
ssh-add ~/.ssh/id_ed25519
将id_ed25519.pub添加到后台网页ssh key中
eval `ssh-agent -s`
修改config文件:
测试:
ssh -vT git@10.18..
darling@h1111 MINGW64 ~/.ssh
$
debug1: load_hostkeys: fopen /c/Users/yourdir/.ssh/known_hosts: No such file or directory
debug1: load_hostkeys: fopen /c/Users/yourdir/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: checking without port identifier
debug1: load_hostkeys: fopen /c/Users/yourdir/.ssh/known_hosts: No such file or directory
debug1: load_hostkeys: fopen /c/Users/yourdir/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: hostkeys_find_by_key_hostfile: hostkeys file /c/Users/yourdir/.ssh/known_hosts does not exist
debug1: hostkeys_find_by_key_hostfile: hostkeys file /c/Users/yourdir/.ssh/known_hosts2 does not exist
debug1: hostkeys_find_by_key_hostfile: hostkeys file /etc/ssh/ssh_known_hosts does not exist
debug1: hostkeys_find_by_key_hostfile: hostkeys file /etc/ssh/ssh_known_hosts2 does not exist
The authenticity of host '[10.18.*.*]:41155 ([10.18.*.*]:41155)' can't be established.
ED25519 key fingerprint is SHA256:YQTF1GhPP+gABu9xpqa+5u9dOCqr9cBySU7Ng+mBsic.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[10.18.*.*]:41155' (ED25519) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /c/Users/yourdir/.ssh/id_ed25519 ED25519 SHA256:ZL5zqdaIG4n9BR8y1PVQsw7pWDj6IS/3k9U3gPqL6iI explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/yourdir/.ssh/id_ed25519 ED25519 SHA256:ZL5zqdaIG4n9BR8y1PVQsw7pWDj6IS/3k9U3gPqL6iI explicit
debug1: Server accepts key: /c/Users/yourdir/.ssh/id_ed25519 ED25519 SHA256:ZL5zqdaIG4n9BR8y1PVQsw7pWDj6IS/3k9U3gPqL6iI explicit
Authenticated to 10.18.*.* ([10.18.*.*]:41155) using "publickey".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
PTY allocation request failed on channel 0
Welcome to GitLab, @darling!
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 10.18.*.* closed.
Transferred: sent 2456, received 2708 bytes, in 0.6 seconds
Bytes per second: sent 4442.7, received 4898.6
debug1: Exit status 0
测试成功