尝试从 GitHub 克隆时权限被拒绝(公钥)错误



我想克隆一个存储库,但我遇到了权限问题,我尝试设置我的用户名和电子邮件,但不断收到错误

我用了

git config --global user.name "yusuf-uthman"
git config --global user.email "yusufuthman57@gmail.com"

但没有得到任何通知,无论是否接受。

Uthman@DESKTOP-30QGK3L MINGW64 ~/Desktop/Scripts/hng_internship5.0
$ git config --global user.name "Uthman Yusuf"
Uthman@DESKTOP-30QGK3L MINGW64 ~/Desktop/Scripts/hng_internship5.0
$ git config --global user.email "yusufuthman57@gmail.com"
Uthman@DESKTOP-30QGK3L MINGW64 ~/Desktop/Scripts/hng_internship5.0
$ git clone git@github.com:yusuf-uthman/hng-internship.git
Cloning into 'hng-internship'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

如何在不出现错误的情况下克隆存储库?

失败来自通过 SSH URLs 克隆您的 GitHub 存储库。要使用该过程,需要在存储库中添加您的公共 SSH 密钥。

相反HTTP URL使用最有可能规避该错误的方法来克隆。

用:

  • HTTP 网址:https://github.com/yusuf-uthman/hng-internship.git

而不是:

  • SSH 网址:git clone git@github.com:yusuf-uthman/hng-internship.git

但没有得到任何通知,无论是否接受。

用户名和电子邮件只是 git 配置文件中的设置,没有人会接受或拒绝它。如果提交,设置的值将用于确定提交作者和提交者。

对存储库的访问权限通常通过 ssh 密钥进行管理。请参阅使用 SSH 连接到 GitHub。

最新更新