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

0 min read 137 words

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.

How to solve this error

ssh-add ~/.ssh/id_rsa

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`

or:

eval $(ssh-agent -s)

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

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags

Recent Posts