我希望能够从Gitbash、cygwin和cmd窗口运行git命令。。。这可行吗?无论如何,现在什么都不起作用,所以我开始使用Windows cmd。
我的SSH配置文件位于以下位置:c:\Users<我的用户id>。ssh\config
Host <info removed>
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
我的SSH文件夹中还有两个SSH文件:
- id_rsa
- id_rsa.pub我遵循了以下指南:https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/
使用以下命令生成:
C:Users<info removed>.ssh>ssh-keygen
Generating public/private rsa key pair.
...
no passkey added
...
将id.rsa.pub中的公钥上传到Bitbucket,并将其与SSH密钥放在一起。
我在这里有一个sshd_config:C: \ProgramData\ssh\shd_config没有做出任何更改,但我认为一些有趣的行是:
#PubkeyAuthentication yes
#PasswordAuthentication yes
#PermitEmptyPasswords no
获取WindowsCapability-联机|?类似名字的";openssh*";…提供为服务器和客户端安装的
运行一些附加命令:
设置服务ssh代理-StartupType自动
启动服务ssh代理
ssh添加$HOME\.ssh\id_rsa
C:Users<my user id>sourcerepos>git clone ssh://<info removed>.git --config core.sshCommand="ssh -v"
Cloning into 'myRepo'...
OpenSSH_9.0p1, OpenSSL 1.1.1o 3 May 2022
debug1: Reading configuration data /c/Users/<my user id>/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to <info removed> port <info removed>.
debug1: Connection established.
debug1: identity file /c/Users/<my user id>/.ssh/id_rsa type 0
debug1: identity file /c/Users/<my user id>/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_xmss type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_xmss-cert type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_dsa type -1
debug1: identity file /c/Users/<my user id>/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
debug1: Remote protocol version 2.0, remote software version APACHE-SSHD-2.2.0
debug1: compat_banner: no match: APACHE-SSHD-2.2.0
debug1: Authenticating to <info removed> as 'git'
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: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: (no match)
Unable to negotiate with <info removed> port <info removed>: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我也不明白什么时候、哪里以及为什么使用所有配置文件。
听起来id_rsa.pub还没有添加到Bitbucket中,但它已经添加了!
这行";读取配置数据/etc/ssh/ssh_config";当我使用Windows时会感到困惑。
所以求你了,我真的需要一些帮助来完成这项工作。
从这个线程和"SSH-RSA密钥被拒绝;无相互签名算法">
为了重新启用ssh-rsa支持,在受影响的ssh客户端的配置文件中插入以下行可以重新启用此算法(
%USERPROFILE%.sshconfig
(:PubkeyAcceptedKeyTypes+Sh-rsa
或者,您可以生成ed25519公钥算法
ssh-keygen -t ed25519 -P ""
OP fishfloat在评论中报告重新安装了Git For Windows,选择使用外部SSH客户端并解决了问题。