Git "Could not read from remote repository. Please make sure the correct access rights. " Solution Solutions

Source: Internet
Author: User
Tags git clone

When we use Git clone or other commands, we sometimes encounter these kinds of problems,

Fatal:could not read from remote repository.

Sure you have the correct access rights

and the repository exists.

Fatal:could not read from remote repository. Please make sure the correct access rights and the repository exists.

This problem occurs because no SSH key is added to the GitHub account

Here's how to fix it:

1. In terminal input.

Ssh-keygen-t rsa-c "username" (Note: username is your username on git)

The above username (usually assigned by the administrator, they should not create the permissions)

If the execution succeeds. Return

Generating public/private RSA key pair.

Enter file in which to save the key (/USERS/USERNAME/.SSH/ID_RSA):

Generating public/private RSA key pair.
Enter file in which to save the key (/USERS/USERNAME/.SSH/ID_RSA):

First of all, explain that the username here is your username on your computer.

Then, here is the setting of the storage address. We press ENTER directly (always press ENTER on the line), there will be one of two situations:

(1) If normal operation, will appear

Enter passphrase (empty for no passphrase):

And then we go straight in.

(2) Sometimes we may appear

/users/your Username/.ssh/id_rsa already exists.

Overwrite (y/n)?

This means that you have set the storage address, we enter "Y" to overwrite

Overwrite (y/n)? Y

Enter

After any of the above two cases, there will be

Enter same Passphrase again:

Enter again and you will see:

Your identification has been saved In/users/username/.ssh/id_rsa.

Your public key has been saved in/users/username/.ssh/id_rsa.pub.

The key fingerprint is:

58:42:8b:58:ad:4b:b5:b9:6d:79:bf:8c:f9:e2:2b:ed username

The key ' s Randomart image is:

+--[RSA 2048]----+

| ...          |

|         O oo. |

| .        . ooo. |

| o o+ |

| . ..       OS. |

| . .      + . |

| .     O. |

| .    o+. |

|   +e++. |

+-----------------+

This means that SSH key has been generated. The file directory is:/users/username/.ssh/id_rsa.pub.

We execute the cat command to view the contents of the file:

Cat/user/username/.ssh/id_rsa.pub

This time you will see:

Ssh-rsa aaaab3nzac1yc2 .....

I omitted the following.

(Description: Ssh-rsa behind the content this is your SSH keys)

Add the displayed SSH keys directly to the SSH keys inside the GitHub account settings(all keys include Ssh-rsa and all the following)

And then execute the git clone command at the end.

Git "Could not read from remote repository. Please make sure the correct access rights. " Solution Solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.