Article Directory
problem
The following prompt is encountered when the favorite project is pulled locally:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Then you may want to clone a private project. In this case, you need to configure the key on Linux.
solution
linux generate ssh key
ssh-keygen -t rsa -C 邮箱
The following tips can use the default value if you don’t know what to set, that is, all the way Enter
down
If the default address is used above, enter
cd /root/.ssh
If you have filled in the address to save the key, enter the address you filled in
View key:
cat id_rsa.pub
Copy the contents to add on github later
add key on github
Two setting methods are provided, the latter is more reliable, and you can skip the first method if you don’t want to fork the project.
First fork the project on github. Then enter the project settings Setting, select Secrets in the left menu:
select on the right New repository secret
, Value
and paste the secret key generated in the previous step in it:
Name
you can fill in Add secret
it at will, and you can use the following command to pull it later:
git clone 项目的ssh克隆地址
If the same error is reported after the above steps are executed, try to add an ssh key: enter personal setting->left menu bar and click SSH and GPG keys-"New SSH key-" name it, fill in the content in the generated document above . Just use the command to pull again