Git error can't push 'Please make sure you have the correct access rights and the repository exists.

Hi everyone,

thought this is kind of strange and would appreciate if anyone can help.

I was added as a collaborator to a private github project of an organisation. I tried to open the repo link on the browser and it opens, so I must have access to the repo, right?

I tried the

git clone

operation via SSH and was successful.

I init git, and checked all the branches. There were all the local branches as well as the remote branches. I checked 

git remote -v

and it has all the correct ssh urls for the project (for push and fetch) as origin.

However, after creating a new branch called test and then trying to

git push origin test

I was hit by this error message:

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

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

I then ran the command 

ssh -T git@github.com

and it gives me this message:

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

So this means I’m authenticated, and that username is the same username (account) as the one I’m running on the browser, and as I said above, I can visit the repo on the web, I can clone, yet I can’t push to it.

I’ve tried creating a new ssh key, but nothing seems to change. Can this be the fault of the repo owner (not giving me the right access or smth)?

Any thoughts??

Thanks.

1 Like

Hi @shonsirsha,

Thank you for being here!  Shell access is not available to GitHub over SSH, however you can perform git operations over SSH instead of supplying your username / password:
https://help.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

I have the same issue but I have connected my github to SSH. Is there any reason that I might still get an error message of:
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
When I run git push -u origin .

Any help would be great as I am very confused. Thank you!

Is the origin repository one you own or have been granted push access by the owner? If not you’ll have to fork it and push to your fork. You can then create a pull request to ask for your changes to be imported into the origin repository.

Thank you. It turns out that for the origin repository I was not granted push access by the owner. I only had read-only access and was able to push after getting write access to the repository.

1 Like