Homebrew installation fails?

(I’m trying to install Homebrew as part of The Odin Project’s online course, so note that I’m a beginner.) I gave the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

It then goes through a lengthy process and ultimately tells me:

remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (43/43), done.
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Failed during: git fetch origin --force
==> Installation successful!

But installation surely is not successful, as when I try to use the ‘brew’ command to proceed with my task, the following occurs:

(base) Leos-MBP:~ leo$ brew install git
-bash: brew: command not found

It’s really frustrating, does anyone know what’s going wrong? (The purpose of my installing Homebrew is to install the latest Git.)

I am wondering if it is a connection issue

Quite possibly! It’s a very big download though, so I’m not sure how to avoid losing connection during.

It is, so there’s not much I can help you with here.

So is there nothing we can do? I read about shallow cloning the git repo, but that didn’t work.

You can try https://docs.brew.sh/Installation#alternative-installs

You could try using a vpn and see if that works?