Git

Git error: “Please make sure you have the correct access rights and the repository exists”

Git developers mostly encounter the “Please make sure you have the correct access rights and the repository exists” error while performing the push or pull operations. This error occurs when the tracked remote URL is not added, or developers are not allowed to access the particular repository for security reasons. To resolve this particular error, it is required to add the remote URL as a tracking repository.

This blog will explain the method for resolving the discussed Git repository error.

How to Resolve the “Please make sure you have the correct access rights and the repository exists” Error?

Perform the following steps to resolve the above-stated error:

Step 1: Switch to Git Repository

At first, go to the Git required repository by executing the “cd” command:

$ cd "C:\Users\nazma\Git\test1"

Step 2: List Repository Content

Then, use the “ls” command to view the list of existing repository content:

$ ls

Step 3: Git Pull Remote Origin

Now, download the updated content of the required remote repository with the help of the following command:

$ git pull origin

As you can see, when we are trying to pull the remote repository’s latest code version, it shows the highlighted error:

Now, to resolve the above-displayed error, first view the remote URL.

Step 4: Check Remote URL’s List

Use the given below command to view the remote repository URL list:

$ git remote -v

It can be seen that the remote URL list is empty:

Step 5: Add Remote URL

To add the required remote repository URL, run the “git remote” command:

$ git remote add origin https://github.com/GitUser0422/demo.git

Step 6: Download Remote Repository Content

Finally, execute the “git pull” command for updating the local repository:

$ git pull origin

It can be observed that the pull operation has been performed successfully:

We have compiled the easiest way to resolve the mentioned error.

Conclusion

To resolve the “Please make sure you have the correct access rights….” error, first, move to the Git repository and list its content. Then, add the remote URL to the list with the help of the “git remote add <remote-name> <remote-url>” command. Finally, execute the “git pull <remote>” command. This blog explained the procedure for resolving the specified error.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.