The “Please make sure you have the correct access rights” error occurs if you do not have the right permissions to access a Git repository. To solve this error, make sure you are referring to the correct remote URL and that you have set up SSH authentication correctly.
The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication. To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.
how can i check write access to a git repository, if i do have a clone of it? A very easy way to check is whether you see an edit 'pencil' icon in the top right of the README.MD on the main Code page of the repo (scroll down to it if there's a long list of top level files/folders).
Under your repository name, click Settings. In the "Access" section of the sidebar, click Collaborators & teams. Click Invite a collaborator. In the search field, start typing the name of person you want to invite, then click a name in the list of matches.
Your git URL might have changed. Change the URL in the local directory by using the following command
for https protocol
git remote set-url origin https://github.com/username/repository.git
for ssh protocol
git remote set-url origin [email protected]:username/repository.git
there might be multiple causes for the issue
That problem might be having with your ssh-agent, your ssh key hasn't been added with ssh-agent.You have to apply following steps using your terminal:-
$ eval "$(ssh-agent -s)"
Agent pid 5867
$ ssh-add
Enter passphrase for /home/you/.ssh/id_rsa: [] Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)
then it will work..cheers J.
Try to use HTTPS instead SSH while taking clone from GIT, use this Url for take clone , you can use Gitbase, Android Studio or any other tool for clone the branch.
For me it was because of no SSH key on the machine. Check the SSH key locally:
$ cat ~/.ssh/id_rsa.pub
This is your SSH key. Add it to your SSH keys in the repository.
In gitlab go to
profile settings -> SSH Keys
and add the key
Github now uses a url scheme
git remote set-url origin https://github.com/username/repository.git
This issue can be caused because sometimes ssh-agent
is not persistent across reboots. You should check if ssh-agent
has your key added:
ssh-add -l -E md5
if you get the output like:
The agent has no identities.
it means ssh-agent
has lost your key. In that case, you simply need to add the identity key again. Something like:
ssh-add ~/.ssh/git_rsa
The error should disappear now!
If you're on a shared machine, using your own password or passwordless private key might be overkill. The safer option is an access token:
$ git clone https://<token>@github.com/<user>/<repo>.git
If you've already cloned the repo, you could just modify your remote setting:
$ git remote set-url origin https://<token>@github.com/<user>/<repo>.git
$ git pull
Already up to date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With