1

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
1
  • 2
    It is not SSH over HTTPS it is SSH over the HTTPS port. The protocol is still SSH just the used port changes from 22 to 443. Commented Apr 28, 2020 at 11:16

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

@iter-ator, if your original problem is the need to type your password each time you access your github repos via HTTPS, you might consider using the Git's "credentials cache" which may be set up to hold your credentials in memory for a configurable amount of time. See git help credentials. It's not exactly a solution but is better than nothing. (And with SSH keys you still have to decrypt them when adding them to the SSH agent, which is basically almost the same thing.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.