Iter Ator
Iter Ator

Reputation: 9279

How is it possible to use SSH key if I connect to a repository using https?

The company firewall does only allow https connection to github.com ( no ssh ), so I added the repository like this:

git remote add origin https://github.com/myProject.git

Unfortunately if I call git push, github asks for my username and password. I already created an ssh key using ssh-keygen.

How is it possible to use SSH keys with a https repository?


I tried SSh over HTTPS:

ssh -T -p 443 [email protected]

But I get this error:

ssh: connect to host ssh.github.com port 443: Connection refused

Upvotes: 0

Views: 746

Answers (1)

kostix
kostix

Reputation: 55443

The error is supposedly because ssh.github.com is a dedicated server (I think several of them, and it resolves to the two distinct IP addresses presently), and your company's firewall supposedly only whitelists connections to "basic" github.com which resolves to a set of hosts different to those of ssh.github.com.
This is needed because in both cases the server-side software handling incoming connections on the same port has to be different (an SSH server versus a web server speaking HTTPS).

As to your general question — no, this is not possible: SSH (the Secure SHell protocol and HyperText Transfer Protocol, Secure) bear no relation to each other except for the fact they both provide security (authentication and confidentiality) for the communication channels they manage.

Upvotes: 1

Related Questions