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

I am using TortoiseGit on Windows. When I am trying to Clone from the context menu of the standard Windows Explorer, I get this error:

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

More precisely, the snapshot of terminal is the following:

git.exe clone --progress -v "git@arobotdev:\git\AlfaRobot.git" "C:\Work\AlfaRobot"

Cloning into 'C:\Work\AlfaRobot'...
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.

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

git did not exit cleanly (exit code 128) (21450 ms @ 19.09.2014 10:36:58)

What should I do to make git work properly ?


Solution 1:

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

  1. If the issue is with your ssh identity, go through @onkar-m18 answer here
  2. If ssh key is not added to hosting server, go through @lovekush-vishwakarma answer here

Solution 2:

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:-

  1. $ eval "$(ssh-agent -s)"

    Agent pid 5867

  2. $ 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.