key_load_public:即使文件存在,也没有这样的文件或目录

oct*_*ian 8 git ssh

我正在尝试连接到 Bitbucket 服务器。我的机器有 Windows,有 Git Bash。

/h/.ssh/id_rsa和 上/h/.ssh/id_rsa.pub,我有一个存储库的密钥。同样在/h/.ssh/config,我有存储库的配置:

Host my-repo-name
        User my-user
        Hostname my-repo.com
        Port 7999
        IdentityFile id_rsa
Run Code Online (Sandbox Code Playgroud)

当我尝试像这样连接到存储库时:

ssh -Tv git@my-repo.com
Run Code Online (Sandbox Code Playgroud)

我收到这条消息:

OpenSSH_7.1p2, OpenSSL 1.0.2h  3 May 2016
debug1: Reading configuration data /h//.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to my-repo.com port 22.
debug1: Connection established.
debug1: identity file /h/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
Run Code Online (Sandbox Code Playgroud)

这里有两件事我不明白:

1.如果我有/h/.ssh/id_rsa/h/.ssh/id_rsa.pub,为什么我会得到key_load_public: No such file or directory

2.如果在我指定的配置中Port 7999,为什么它连接到端口22 Connecting to my-repo.com port 22

Jak*_*uje 3

  1. 如果我有 /h/.ssh/id_rsa 和 /h/.ssh/id_rsa.pub,为什么我会收到 key_load_public: No such file or directory?

这只是虚假的警告。如果您使用更详细的日志级别运行,则可以找到更多信息-vvv

  1. 如果在配置中我指定端口 7999,为什么它会连接到端口 22 连接到 my-repo.com 端口 22?

因为Port 7999仅为 host 指定my-repo-name,而不是my-repo.com您尝试连接的位置。如果你跑的话它会被使用

ssh -Tv git@my-repo-name
Run Code Online (Sandbox Code Playgroud)