Problem:
When trying to clone a repo from SSH url (e.g. git@github.com:repo-account/my-project.git), sometimes you may encounter an error like below:Cloning into 'C:\user\projects\my-project\ssh-code\test\dotcom-my-repo'...
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Root Cause:
Solution:
In such scenarios ensure following things:1. Ensure public ssh key is added to github account
2. Instead of using any git UI tool, open git "bash" window
4. If you have just one ssh key for all projects then simply run below command in bash window:
git clone git@github.com:repo-account/my-project.git
In case you get into issues, try creating a fresh ssh key and add it to github account.
If you have more than one ssh key and want to use specific key for this checkout then run below command:
GIT_SSH_COMMAND="ssh -i C:/Users/vivmishr/.ssh/abc" git clone git@github.com:repo-account/my-project.git
Hope it works!
No comments:
Post a Comment