Git error when uninstall/install attempt?

So I uninstalled Homebrew from my computer for some reasons using a Ruby command, which said “This will uninstall all packages installed with Brew”. I did this and now when I try to install Homebrew again, I get a Git error saying “Please make sure you have correct Access Rights”.

I assumed this error was because uninstalling Brew uninstalled Git, but when I type “git --version” I get “git version 2.15.0” so that isn’t the issue.

I then generated a new SSH key, and added the public key to my git account. Doing

ssh -T git@github.com

Gives me

Hi {{username}}! You've successfully authenticated, but GitHub does not provide shell access

Even when I try to git clone my own repo, I get the same error:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

This is log of the Brew install

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Homebrew
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown rafaykalim /usr/local/Homebrew
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Homebrew
==> Downloading and installing Homebrew...
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

I also manually removed the /usr/local/Homebrew. This is the command to uninstall Brew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

EDIT: I just uninstalled git from my computer, and I am still getting the same error. Have no idea what is going on!

I used this script to uninstall Git: https://gist.github.com/naomik/11245234

EDIT: I just uninstalled git from my computer, and I am still getting the same error. Have no idea what is going on!

The script you linked doesn’t uninstall git. Git is a system command on macOS and there isn’t really a way to uninstall it.

I then generated a new SSH key, and added the public key to my git account.

Homebrew doesn’t use SSH based access by default. It uses HTTPS based access, could it be that something is blocking that access to github.com? What happens when you manually try to clone any github repo using HTTP?