git - 通过共享互联网从远程服务器连接到 Github
问题描述
我已使用此文档通过离线远程服务器共享我的本地互联网。一切正常,远程服务器现在有互联网。apt、curl 等大多数东西都在工作。但是当我想通过下面的命令连接到 github 时:
ssh -T git@github.com
我收到此错误:
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”。
正如 OP 所建议的,仍然使用 ssh 意味着:
git config https.proxy http://a/proxy
- 使用
bryanpkc/corkscrew
, 一个通过 HTTP 代理建立 SSH 隧道的工具
(假设这不违反当地 IT 政策)
例如,参见Vincent Danen的“ Using Corkscrew to tunnel SSH over HTTP ” :
编辑您的 SSH 配置文件 ~/.ssh/config,并添加:
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 将 透明地转换为
%h
要连接的主机名 (somehost.example.com
) 和要连接的端口(默认为 22)。这里的
ProxyCommand
行是告诉 OpenSSH 启动 Corkscrew 程序以建立与最终 SSH 服务器的实际连接。> 您可以为您可能需要连接到的所有主机创建多个条目,或者在行中使用简单的正则表达式或全局星号 (*
)Host
(*
将告诉 OpenSSH 将此Host
节用于所有连接)。
推荐阅读
- python - 如何在 Django 项目中使用 Feedparser
- vb.net - 比较字符串和数组 VB
- r - 如何访问 R 中的栅格全局属性?
- python - “不是一个有效的字符串。” - 尝试在 Django Rest Framework 中将 dict 保存到 TextField 时出错
- typescript - 无法使用 Office JS 删除 Word 中的嵌套内容控件
- angular - 使用 AngularFirestore 和 firebase 的“ERROR TypeError: Object(...) is not a function”
- r - 如果满足条件,则复制前一行
- sql - SQL Server 存储过程 - 如果存在则跳过,否则插入
- sql - 例如,高于特定价值(500 美元)的商品的百分比?
- android - Bundle 是可以为空的,即使我没有这样声明它