git "Could not read from remote repository.Please make sure you have the correct

When we use git clone or other commands, we sometimes encounter such problems, as shown in the figure:

fatal: Could not read from remote repository.



Please make sure you have the correct access rights

and the repository exists.

fatal: Could not read from remote
repository. Please make sure you
have the correct access rights and the repository exists.

This problem occurs because the SSH key is not added to the github account . The

solution is as follows:
1. Type in the terminal.

ssh-keygen -t rsa -C "username" (Note: username is your username on git)


if the execution is successful. Returns

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, let me explain that the username here is the username on your computer.

Then , here is the setting of the storage address. If we press Enter directly, one of the following two situations will appear:

(1) If it is running normally, it will

Enter passphrase (empty for no passphrase) appears :

then we enter directly

(2) Sometimes we may appear

/Users/your username/.ssh/id_rsa already exists.

Overwrite (y/n)?

This means that you have set After entering the storage address, we enter "y" to overwrite

Overwrite (y/n)? y

Enter After any two of the



above cases,

Enter same passphrase again:

Enter again, then 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 the 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 At

this time, we will see:

ssh-rsa AAAAB3NzaC1yc2. . . . . . . . .

I omitted the following content
(Note: the content after ssh-rsa is your SSH keys),

add the displayed SSH
keys directly to the SSH keys in the github account settings,

and then execute the git clone command.

See original text: http://blog.csdn.net/u014343528/article/details/48787221

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326266906&siteId=291194637