gpt4 book ai didi

git - Google Compute Engine VM,添加的负载均衡器现在不能 git pull

转载 作者:行者123 更新时间:2023-12-02 14:16:31 24 4
gpt4 key购买 nike

我有一个谷歌计算引擎,我在上面设置了一个 git repo,一切都很顺利,我在 git 上 pull 零问题。然后,我设置了一个负载均衡器并为我的虚拟机创建了一个 NEG,并且能够让 https 运行。但是,现在当我运行 git pull 它什么也不做。它只是卡在那里没有输出,即使我使用 -v它没有输出,只是无限期地挂起。我什至不知道负载均衡器和 https 设置是否相关,但我想不出其他任何东西。我已经尝试过重新生成 SSH key 但没有任何效果。有任何想法吗?
这是我的 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 应该打开。

最佳答案

John Hanley 所述在评论中,并在“Compue Engines / Securely connecting to VM instances / Traffic egress using NAT gateways”中详细说明

When an instance does not have an external IP address assigned it cannot make direct connections to external services, including other Google Cloud services.

To allow these instances to reach services on the public internet, you can set up and configure a NAT gateway machine, which can route traffic on behalf of any instance on the network

Cloud NAT is a distributed, software-defined managed service.
It's not based on proxy VMs or appliances.

Cloud NAT configures the Andromeda software that powers your VPC network so that it also provides source network address translation (SNAT) for VMs without external IP addresses.
Cloud NAT also provides destination network address translation (DNAT) for established inbound response packets.

Traditional NAT vs. Cloud NAT -- https://cloud.google.com/nat/images/07.svg

关于git - Google Compute Engine VM,添加的负载均衡器现在不能 git pull,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63307465/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com