[英]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:公司防火墙只允许 https 连接到 github.com(没有 Z1787D7646304C5D987777CFE)
git remote add origin https://github.com/myProject.git
Unfortunately if I call git push
, github asks for my username and password.不幸的是,如果我调用
git push
, github 会询问我的用户名和密码。 I already created an ssh key using ssh-keygen
.我已经使用
ssh-keygen
创建了一个 ssh 密钥。
How is it possible to use SSH keys with a https repository?如何将 SSH 密钥与 https 存储库一起使用?
I tried SSh over HTTPS :我在 HTTPS 上尝试了 SSh :
ssh -T -p 443 git@ssh.github.com
But I get this error:但我得到这个错误:
ssh: connect to host ssh.github.com port 443: Connection refused
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
. 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到一组不同于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).这是必需的,因为在这两种情况下,处理同一端口上的传入连接的服务器端软件必须不同(SSH 服务器与 web 服务器使用 HTTPS)。
As to your general question — no, this is not possible: SSH (the S ecure SH ell protocol and H yper T ext T ransfer P rotocol, S ecure) bear no relation to each other except for the fact they both provide security (authentication and confidentiality) for the communication channels they manage.至于您的一般问题-不,这是不可能的: SSH (安全SH ell协议和超文本传输协议,安全)彼此没有任何关系,除了它们都提供安全性(身份验证和机密性)用于他们管理的通信渠道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.