Had this same issue when working on a MacBook Pro.
When I try to clone or push to a repository, I get the error below:
git clone https://github.com/mytech/mytech_frontend.git
Cloning into 'mytech_frontend'...
remote: Repository not found.
fatal: repository 'https://github.com/mytech/mytech_frontend.git/' not found
This often happens if the computer already has github.com credentials configured in the CLI for another user.
Here's how I solved it:
For Git Clone
First, be sure you have access to the repository either as:
- a member of the organization in which the repository resides OR
- a collaborator of the repository
Next, clone the repository using:
git clone https://github.com/path_to/my-repo.git
if you have an existing GitHub account on the computer/terminal, when you try to clone from a repository with another GitHub account you will encounter the same error, so you need to modify your git clone command to:
git clone https://my-username:'personal-access-token'@github.com/path_to/my-repo.git
Example:
git clone https://promisepreston:'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'@github.com/promisepreston/my-writings.git
For Git Push
List the existing repo remote location:
git remote -v
Output:
origin https://github.com/my-username/my-repo.git (fetch)
origin https://github.com/my-username/my-repo.git (push)
Remove the existing remote location:
git remote remove origin
Add the repo remote location again using this pattern:
git remote add origin https://my-username:'personal-access-token'@github.com/path_to/my-repo.git
Example:
git remote add origin https://promisepreston:'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'@github.com/promisepreston/my-writings.git
git remote add origin [email protected]:account-name/repo-name.git
. It exists in GitHub, and its a private repo.[remote "origin"]
section.