有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,GitHub存储库存在,我不知道现在该做什么。
> git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,GitHub存储库存在,我不知道现在该做什么。
> git push -u origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
当前回答
这发生在我身上。出于某种原因,我的出身在我没有意识到的情况下被搞砸了:
检查您的设置是否仍然正确
git remote -v
url需要像ssh://git@github.com/YourDirectory/YourProject.git; 如果没有看到git@github.com,请使用
git remote set-url origin git://github.com/YourDirectory/YourProject.git
纠正错误。或者你可以使用github应用程序在特定存储库的设置面板中检查和设置主远程存储库url。
其他回答
这发生在我身上。出于某种原因,我的出身在我没有意识到的情况下被搞砸了:
检查您的设置是否仍然正确
git remote -v
url需要像ssh://git@github.com/YourDirectory/YourProject.git; 如果没有看到git@github.com,请使用
git remote set-url origin git://github.com/YourDirectory/YourProject.git
纠正错误。或者你可以使用github应用程序在特定存储库的设置面板中检查和设置主远程存储库url。
你在你的~/中创建了配置文件吗?ssh目录吗?它应该有这样的内容:
Host github.com
IdentityFile ~/.ssh/github_rsa
假设您创建了一个名为github_rsa的ssh密钥
然后上传到GitHub…
注意:如果~/中有多个键(2个或更多),则必须采用这种显式配置方式。ssh /目录。如果你不这样指定密钥,那么第一个密钥将被用于github身份验证,因此它取决于密钥文件名。
在将GitHub添加为远程时,使用该页面的URL。 它不会引起任何这样的错误和推动代码
如果您将ssh访问更改为https访问远程存储库,问题就解决了:
git remote set-url origin https_link_to_repository
git push -u origin master
我想补充一些我的发现:
如果您正在使用GitBash,那么请确保SSH密钥存储在~/. SSH /id_rsa中。
默认情况下,git会搜索~/。ssh/id_rsaas ssh密钥的默认路径。
甚至文件名id_rsa也很重要。如果您将SSH密钥保存在另一个文件名或路径中,它将抛出Permission Denied(publickey)错误。