有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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.
当前回答
另一个解决方案:
创建SSH密钥,输入SSH -keygen -t rsa -C "your_email@example.com"这将创建id_rsa和id_rsa。酒吧的文件。
将id_rsa添加到本地计算机的ssh列表:ssh- Add ~/.ssh/id_rsa。
生成密钥后获取pubkey使用:
cat ~/.ssh/id_rsa.pub
你会得到这样的东西:
cat ~/.ssh/id_rsa.pub
ssh-rsa AAAB3NzaC1yc2EAAAADAQABAAACAQCvMzmFEUPvaA1AFEBH6zGIF3N6pVE2SJv9V1MHgEwk4C7xovdk7Lr4LDoqEcqxgeJftwWQWWVrWWf7q9qCdHTAanH2Q5vx5nZjLB+B7saksehVOPWDR/MOSpVcr5bwIjf8dc8u5S8h24uBlguGkX+4lFJ+zwhiuwJlhykMvs5py1gD2hy+hvOs1Y17JPWhVVesGV3tlmtbfVolEiv9KShgkk3Hq56fyl+QmPzX1jya4TIC3k55FTzwRWBd+IpblbrGlrIBS6hvpHQpgUs47nSHLEHTn0Xmn6Q== user@email.com
复制这个密钥(值),到github.com,在设置(ssh和PGP密钥)下添加您的公钥。
其他回答
你需要生成一个SSH密钥(如果你没有的话),并将公钥与你的Github帐户相关联。参见Github自己的文档。
使用Https是可以的,运行git config——global credential。帮助wincred创建一个Github凭据帮助存储您的凭据为您。如果这不起作用,那么您需要编辑.git目录中的配置文件,并将原始文件更新为https url。
查看github文档的链接。
如果您没有访问自己的存储库,或者在克隆的存储库中进行克隆(使用一些“git submodule…”“命令):
在存储库的主目录中:
$ ls -a
1. 开放”。,你会发现这样的东西:
[submodule "XXX"]
path = XXX
url = git@github.com:YYY/XXX.git
将最后一行更改为您需要提取的存储库的HTTPS:
[submodule "XXX"]
path = XXX
https://github.com/YYY/XXX.git
保存”。“Gitmodules”,并为子模块运行命令。Git”将被更新。
2. 开放”。Git”,转到“config”文件,你会发现这样的东西:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/YYY/XXX.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[submodule "XXX"]
url = git@github.com:YYY/XXX.git
将最后一行更改为您需要提取的存储库的HTTPS:
url = https://github.com/YYY/XXX.git
因此,在本例中,主要问题只是url。任何存储库的HTTPS现在都可以在存储库页面的顶部找到。
在将GitHub添加为远程时,使用该页面的URL。 它不会引起任何这样的错误和推动代码
我试图用几个小时来解决类似的问题。最后,我删除了所有的密钥,并创建了没有密码的新密钥,最终摆脱了这个问题。
问题是SSH密码,需要删除!