git clone项目 权限 问题

Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

在 git clone 项目时,提示没有权限,不能clone,有以下几种情况

1、可能是 之前电脑使用过git ,现在和之前不是同一个账号,要重置。

git config --system --unset credential.helper

输入上面命令后,再次git clone时,会让我们重新输入 username 和 password.

    注:设置 修改 本地 git 账号和密码:

$ git config --global user.name "yourname"

$ git config --global user.email "youremail"

2、设置后 重新 git clone 发现还是不行。

 有可能是公钥出现问题,重新设置用户名和密码,生成公钥(这里要记得删除之前的公钥)

$ git config --global user.name "yourname"

$ git config --global user.email "youremail"

 删除 .ssh 文件夹

路径:

 git 输入命令

$ ssh-keygen -t rsa -C "youremail"(设置的邮箱地址)

 然后会生成 .ssh文件夹。

打开 .ssh文件下的id_rsa.pub 全部复制,进入git ->setting ->ssh key 新增 ssh key即可。 

原文地址:https://www.cnblogs.com/lpp-11-15/p/13447805.html