【发布时间】:2020-08-07 18:34:54
【问题描述】:
我有一个谷歌计算引擎,我在上面设置了一个 git repo,一切都很顺利,我在 git 上拉动零问题。然后,我设置了一个负载均衡器并为我的虚拟机创建了一个 NEG,并且能够让 https 运行。但是,现在当我运行 git pull 它什么也不做。它只是挂在那里没有输出,即使我使用-v 它也没有输出并且只是无限期地挂起。我什至不知道负载均衡器和 https 设置是否相关,但我想不出其他任何东西。我已经尝试过重新生成 SSH 密钥但没有任何效果。有什么想法吗?
这是我的 git remove -v 输出:
origin git@github.com:LukasDeco/thoughtful.git (fetch)
origin git@github.com:LukasDeco/thoughtful.git (push)
和 git 状态:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
no changes added to commit (use "git add" and/or "git commit -a")
更新:
对于 git fetch origin,这是我从超时得到的输出:
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
然后我尝试使用 https,这是输出:
fatal: unable to access 'https://github.com/LukasDeco/thoughtful.git/': Failed to connect to github.com port 443: Connection timed out
这似乎是网络问题,但我的 VM 上有 default-allow-ssh 防火墙规则,因此端口 22 应该打开。
【问题讨论】:
-
1) 为什么要创建 NEG? Google 负载均衡器不需要 Compute Engine。 2) Compute Engine 的网络配置是什么? 3) 验证您是否可以从 Compute Engine 连接到 Internet 和 github.com(身份可能存在路由问题)。 4)您的问题不清楚,补充更多细节。
-
1) 它让我要么使用 NEG,要么使用实例组,我只想使用一个实例,而我认为实例组让我使用多个实例。 2)我在计算引擎的内部 IP 上。你是这个意思吗? 3)当我在计算引擎上运行 ping 时,它说每次收到 0 个数据包...... 4)基本上我希望 git pull 再次工作
-
1) Google 提供非托管实例组。 2) 如果您的 Compute Engine 实例没有公共 IP 地址,那么您将需要一个 Cloud NAT(或类似的)来提供公共 Internet 访问。还有其他选择,但 Cloud NAT 是最简单的。
-
一旦我添加了 NAT,它又可以工作了!!非常感谢
-
不要忘记选择 VonC 的答案以将问题标记为已回答。
标签: git ssh google-cloud-platform google-compute-engine