有人看到这个错误并知道该怎么做吗?
我正在使用终端,我在根,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.
当前回答
如果您正在使用windows -10,请遵循此说明。这对我很管用。
以管理员身份打开终端 执行命令:"ssh-keygen"。它生成一个ssh密钥,并显示创建密钥的文件夹。检查我的图像 复制生成的ssh密钥 点击“新建SSH键按钮”并粘贴“SSH键”,最后“点击添加按钮”
其他回答
如果您没有访问自己的存储库,或者在克隆的存储库中进行克隆(使用一些“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现在都可以在存储库页面的顶部找到。
您可以使用Https url登录
我猜你是试图登录SSH url 当你说git push,如果它只要求密码,考虑你是通过ssh连接。最好使用HTTP url。
对我来说,我试过这个
eval "$(ssh-agent -s)"
然后我就跑
ssh-add ~/.ssh/path-to-the-keyfile
为了生成密钥,你可以运行
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
这将生成一对密钥(Public和private)。
您可以将此密钥存储到github以了解更多信息,添加一个新的SSH密钥到您的github帐户
我希望它能帮助到其他人:)
好吧,这个问题有一些解决方案,其中一些可能已经提到过了,但只是把它们放在一起:
确保您的键是存在的,默认情况下是另一个~/。Ssh /文件夹,即id。Rsa和id.rsa.pub 确保密钥有正确的权限,你可以运行chmod: Chmod 600 ~/.ssh/id_rsa . exe Chmod 644 ~/.ssh/id_rsa.pub 确保您的公钥(id_rsa.pub)的内容与远程存储库配置中上传的内容匹配 最后修复ssh代理的问题: ssh-add
更多信息:https://itcodehub.blogspot.com/2015/01/ssh-add-problems-with-ssh-agent-and.html
这对我很有用
有2个选项在github - HTTPS/SSH
我错误地选择了SSH,因此出现了错误-_-
切换到HTTPS,然后复制url再次尝试:)