有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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.
当前回答
使用Https是可以的,运行git config——global credential。帮助wincred创建一个Github凭据帮助存储您的凭据为您。如果这不起作用,那么您需要编辑.git目录中的配置文件,并将原始文件更新为https url。
查看github文档的链接。
其他回答
如果您已经创建了SSH密钥,但仍然报错,这是因为您需要给用户读写要克隆到的文件夹的权限。sudo chmod 777 <your_folder_name_here>"。 当然,这是在生成SSH密钥之后,仍然会得到这个错误。希望这对未来的用户有所帮助。
Edit
如果你使用git bash,在Windows中使用admin来添加
我知道这个问题。添加ssh密钥后,也添加您的ssh密钥到ssh代理(来自官方文档)
ssh-agent -s
ssh-add ~/.ssh/id_rsa
一切正常工作后,git可以查看适当的密钥,以前不能。
以防有人需要这个。我在用户的.ssh文件夹中创建了一个不同名称的ssh密钥,如ar-2022-ssh。这样做的问题是,检查现有的SSH密钥指定GitHub支持的公钥是以下之一。
id_rsa.pub
id_ecdsa.pub
id_ed25519.pub
一旦我在生成密钥时将我的ssh密钥名称更改为其中之一,它就可以连接到GitHub
如果您将ssh访问更改为https访问远程存储库,问题就解决了:
git remote set-url origin https_link_to_repository
git push -u origin master
同样在ubuntu中,即使在BitBucket的设置中已经输入了SSH密钥,我还是遇到了这个问题。原因是,我尝试了以下几点:
sudo git push origin master
不知道为什么,但它解决了使用
git push origin master
没有使用sudo。