Skip to content

[Solved] fatal: Could not read from remote repository with Git

If you receive the following error when trying to clone a Git repository:

fatal: Could not read from remote repository.

The full message may look something like this:

$ git clone [email protected]:org/repo.git Cloning into 'repo'... Bad owner or permissions on /Users/ao/.ssh/config fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
Code language: plaintext (plaintext)

How to solve this error

ssh-add ~/.ssh/id_rsa
Code language: Bash (bash)

where id_rsa is a ssh key associated with the repo.

If you get the following error at this stage: Could not open a connection to your authentication agent., then you first need to run the following:

eval `ssh-agent -s`
Code language: Bash (bash)


eval $(ssh-agent -s)
Code language: Bash (bash)

Permissions 0777 for ‘/Users/ao/.ssh/id_rsa’ are too open

If you get this permissions error, then you can fix the id_rsa permissions by doing this:

chmod 0400 ~/.ssh/id_rsa
Code language: Bash (bash)

See also  How to Generate a Random Number/String in Terraform
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x