Git: Permission denied (publickey) fatal – Could not read from remote repository. while cloning Git repository

I am unable to clone a Git repository, and getting this error:

krishna.soni@KRISHNACHANDRAS /c/Projects $ git clone http://stage.abc.com:10088/pqr
http://<url>/<repository> Cloning into '<repository>'... fatal: could not read Username for 'http://<url>': No such file or directory

I’ve read Bitbucket, Windows and “fatal: could not read Password for”, but still have the problem.

I proceeded further but am now getting this error

sh.exe": chown: command not found

krishna.soni@KRISHNACHANDRAS /c
$ git clone ssh://[email protected].
/projects
Cloning into 'C:/projects'...
Permission denied (publickey).
fatal: Could not read from remote repository.

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

> krishna.soni@KRISHNACHANDRAS /c
>     $ git clone ssh:<url>
>     ts
>     Cloning into 'C:/projects'...
>     Permission denied (publickey).
>     fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

31 Answers
31

For people that come here that are just trying to get the repository but don’t care about the protocol (ssh / https), you might just want to use https instead of ssh (if it’s supported).

So for example you use

git clone https://github.com/%REPOSITORYFOLDER%/%REPOSITORYNAME%.git

instead of

git clone [email protected]:%REPOSITORYFOLDER%/%REPOSITORYNAME%.git

Note that GitHub deprecated password authentication (https login) for private repositories due to it not keeping up with the latest security standards.

Note also that beginning March 1, 2022, Bitbucket users will no longer be able to use their Atlassian account password with git over https, but instead need to use Bitbucket app passwords.

Leave a Comment