Pages

Footer Pages

Spring Boot

Java String API

Java Conversions

Kotlin Programs

Kotlin Conversions

Java Threads Tutorial

Java 8 Tutorial

Monday, November 29, 2021

[Fixed] Git - remote: Repository not found in 9 ways (Windows and Mac)

1. Overview

In this tutorial, we'll learn how to fix the "Git - remote: fatal Repository not found" issue in 9 different ways.

You might have seen this error while cloning the repository or while pushing the commits to the remote repository.

This error can be fixed in simple ways.

[Fixed] Git - remote: Repository not found



2. Fix 1 - Git - remote: Repository not found


If you are new to programming and developing then you might have not set remote repo URL on your local repo. And trying to push the changes to remote.

This is needed when you downloaded the project as a zip file.

In this case, you need to set the remote base url to the local repo using the "git remote" command.

More on Git Commands

Follow the below steps.

git remote set-url origin https://github.com/JavaProgramTo/Kotlin-Demo.git

git add *.java
git commit -m "commit title"
git push origin master


3. Fix 2 - Git - remote: Repository not found


If the above is not your case, then you need to make sure that the remote URL is the correct one is pointing out.

Use git remote command as below.

git remote -v
origin	https://github.com/JavaProgramTo/Kotlin-Demo.git (fetch)
origin	https://github.com/JavaProgramTo/Kotlin-Demo.git (push)

If it is showing the right URL then verify it on remote whether it is the correct one or not. If not the correct one then you need to follow fix 1 to set the correct remote repo.


4. Fix 3 - Git - remote: Repository not found


Verify if your password has been reset recently. If you have changed so please make sure the new password is fetched from the credential manager on windows or keychain access on mac.

Sometimes, an old password will be used and a new one is not cached yet.

In this case, Remove all github.com credential details from the system. 
you need to clear the git related info from the credential manager and remove it from keychain access.

On windows

Follow the below commands on windows. After this, you should be able to push and pull the changes.
$ git credential-manager uninstall

$ git credential-manager install


On Mac machine

Open Keychain Access and find your password account in the password category ( you can search it on the top right keychain access page)

Once you find it, delete all keys related to your git source control and then try it again from the clone.

Before this take the backup of your uncommitted changes.


5. Fix 4 - Git - remote: Repository not found


This is a temporary fix and not recommended for the long term.

On Windows

  • Go to the git folder and go inside the .git folder
  • Open 'config' file using notepad or any other editor
  • Change your URL from https://github.com/username/repo_name.git to https://username:password@github.com/username/repo_name.git
  • Save and Push the code, it will work.
Here, you need to save the password and security threat.

On Mac

If the GitHub entry is not present in keychain access then you can clone the app in a different way as below.
git clone https://username@github.com/org/repo.git

Follow the below steps.

  • username with your GitHub username
  • org with your organisation name
  • repo with the repository name

6. Fix 5 - Git - remote: Repository not found


Just run the git remote update command which updates the local repo with the remote repo and its credentials.

If this command is executed without any issues then your issue will be resolved.
git remote update


7. Fix 6, 7, 8, 9- Git - remote: Repository not found


There might be chances of any one of the following.

7.1 If you are not a collaborator, then you may successfully authenticate the GitHub but can not clone or push the changes to the repository as long you are not a collaborator.

7.2 In case of any spelling issues

7.3 If the git remove -v has set to HTTPS but your repo is pointing to the ssh. In this case, you need to remove the ssh and add HTTPS.

git remote remove origin
git remote add origin https://github.com/JavaProgramTo/Kotlin-Demo.git

7.4 Remote repository is not found and deleted.


8. Conclusion


In this article, we've seen all versions of fixes on git error "fatal: repository not found error".


No comments:

Post a Comment

Please do not add any spam links in the comments section.