Reputation: 425
I have a google compute engine that I set up a git repo on and everything was going great and I was git pulling with zero problems. Then, I set up a load balancer and a created an NEG for my VM and was able to get https running. But, now when I run git pull it does nothing. It just hangs there with no output, even if I use -v
it has no output and just hangs indefinitely. I don't even know if the load balancer and https set up is related, but I can't think of anything else. I already tried regenerating SSH keys with no effect. Any ideas?
This is my git remove -v output:
origin [email protected]:LukasDeco/thoughtful.git (fetch)
origin [email protected]:LukasDeco/thoughtful.git (push)
and git status:
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")
For git fetch origin, this is the output I get from the timeout:
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.
Then I tried to use https and this is the output:
fatal: unable to access 'https://github.com/LukasDeco/thoughtful.git/': Failed to connect to github.com port 443: Connection timed out
It seems like a network issue, but I have the default-allow-ssh firewall rule on my VM so port 22 should be open.
Upvotes: 1
Views: 302
Reputation: 1329712
As noted by John Hanley in the comments, and detailed in "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.
Upvotes: 3