Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

key_load_public: No such file or directory even though file exists

Tags:

git

ssh

I am trying to connect to a Bitbucket server. My machine has Windows, with Git Bash.

On /h/.ssh/id_rsa and /h/.ssh/id_rsa.pub, I have a key for the repository. Also in /h/.ssh/config, I have the configuration for the repository:

Host my-repo-name
        User my-user
        Hostname my-repo.com
        Port 7999
        IdentityFile id_rsa

When I'm trying to connect to the repository like this:

ssh -Tv [email protected]

I'm getting this message:

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

There are two things I don't understand here:

1.If I have /h/.ssh/id_rsa and /h/.ssh/id_rsa.pub, why am I getting key_load_public: No such file or directory?

2.If in the configuration I specify Port 7999, why does it connect to port 22 Connecting to my-repo.com port 22?

like image 408
octavian Avatar asked Mar 20 '17 14:03

octavian


1 Answers

  1. If I have /h/.ssh/id_rsa and /h/.ssh/id_rsa.pub, why am I getting key_load_public: No such file or directory?

It is just bogus warning. More information can be found if you run with more verbose log level -vvv.

  1. If in the configuration I specify Port 7999, why does it connect to port 22 Connecting to my-repo.com port 22?

Because the Port 7999 is sepcified only for host my-repo-name, not for my-repo.com where you are trying to connect. It would get used if you would run

ssh -Tv git@my-repo-name
like image 97
Jakuje Avatar answered Oct 04 '22 01:10

Jakuje