有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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。
其他回答
我也遇到了和蝙蝠侠类似的问题。但是,因为我是在/usr/local/src/projectname下运行的,所以不使用sudo是不行的。
只需添加-E标志来保护环境(您的~/。ssh /路径)。
$ sudo -E git克隆git@your_repo
来自man sudo:
- e, preserve-env 指示用户希望预先设置的安全策略 服务于它们现有的环境变量。安全 如果用户没有权限,策略可能会返回错误 保护环境。
可能您的ssh-agent未启用 你可以试试
下载
http://git-scm.com/
安装它 使ssh-agent
C:\Program Files\Git\cmd
start-ssh-agent
我试图用几个小时来解决类似的问题。最后,我删除了所有的密钥,并创建了没有密码的新密钥,最终摆脱了这个问题。
问题是SSH密码,需要删除!
确保SSH -add -l显示存在于Github帐户的SSH密钥列表中的SSH密钥的指纹。
如果输出为空,但你知道你有一个与你的github帐户一起使用的私有SSH密钥,在这个密钥上运行SSH -add(在~/. SSH中找到。默认情况下,它被命名为id_rsa,因此您可能会运行ssh-add id_rsa)。
否则,按照下面的说明生成SSH密钥对。
你在你的~/中创建了配置文件吗?ssh目录吗?它应该有这样的内容:
Host github.com
IdentityFile ~/.ssh/github_rsa
假设您创建了一个名为github_rsa的ssh密钥
然后上传到GitHub…
注意:如果~/中有多个键(2个或更多),则必须采用这种显式配置方式。ssh /目录。如果你不这样指定密钥,那么第一个密钥将被用于github身份验证,因此它取决于密钥文件名。