git - 通过共享互联网从远程服务器连接到 Github

标签 git ssh

我已使用 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 the Host line (* will tell OpenSSH to use this Host stanza for all connections).

关于git - 通过共享互联网从远程服务器连接到 Github,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67985175/

相关文章:

asp.net - 基于浏览器(免费使用)的 SSH

ssh - 如何在 ssh 脚本中间切换到用户 jenkins?

git - 我如何从 'git log' 命令中退出并处理它并继续执行其他命令?

linux - 如何在不实际执行 ssh 的情况下查找是否可以通过 SSH 访问远程主机

git - SSH key 要求在启动代理后输入密码

git - 如何获取有效的 git-config 值及其来源?

Git 通过 http 但不是 ssh 工作

来自现有自定义 SVN 的 git-svn 文件夹

git - 将 Git 与 Ant 集成的最佳方式?

git - 在 GitHub 上作为文件上传的文件夹