我已使用 this documentation 通过离线远程服务器共享我的本地互联网。一切正常,远程服务器现在有互联网。像 apt、curl 等大多数东西都可以工作。但是当我想通过下面的命令连接到 github 时:
ssh -T <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="96f1ffe2d6f1ffe2fee3f4b8f5f9fb" rel="noreferrer noopener nofollow">[email protected]</a>
我收到此错误:
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
有人可以帮忙吗?
最佳答案
如果 curl 可以工作,但 SSH 不能工作,请至少尝试使用 HTTPS 进行克隆:
git clone https://github.com/<me>/<myRepo>
如果需要,您可能需要定义一个代理 (HTTP_PROXY
/HTTPS_PROXY
),并将 NO_PROXY
设置为“127.0.0.1” ,localhost,.mycompany.com”。
仍然使用 ssh 意味着,正如OP所建议的:
git config https.proxy http://a/proxy
- 使用
bryanpkc/corkscrew
,一种通过 HTTP 代理建立 SSH 隧道的工具
(假设这不违反本地 IT 政策)
例如,参见 Using Corkscrew to tunnel SSH over HTTP 中的“Vincent Danen ” :
edit your SSH configuration file, ~/.ssh/config, and add:
Host somehost Hostname somehost.example.com #ssh.github.com for Github Port 443 #443 for Github ProxyCommand /user/bin/corkscrew proxy.example.com 3129 %h %p
OpenSSH transparently converts the
%h
to the hostname to connect to (somehost.example.com
) and the port to connect to (22, by default).The
ProxyCommand
line here is telling OpenSSH to start the Corkscrew program to make the actual connection to the end SSH server. > You can create multiple entries for all of the hosts you may need to connect to, or use a simple regular expression or the global asterisk (*
) in theHost
line (*
will tell OpenSSH to use thisHost
stanza for all connections).
关于git - 通过共享互联网从远程服务器连接到 Github,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67985175/