我试图将我的博客(Octopress)推送到 github 并收到此错误:
MacBook-Air:octopress bdeely$ git push origin source
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我生成了一个 SSH 密钥,保存了它,甚至在 SSH 密钥设置中将它与我的 GitHub 帐户相关联,但我继续检查状态并得到相同的错误:
MacBook-Air:.ssh bdeely$ ssh -T git@github.com
Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)
除此之外,我查看了github 的帮助页面,执行了以下操作并收到此错误消息:
MacBook-Air:~ bdeely$ ssh-add -l
The agent has no identities.
Run Code Online (Sandbox Code Playgroud)
有谁知道出了什么问题以及我如何解决这个问题?
我使用 PuTTy 密钥生成器创建了一个公钥。我将公钥复制到david.pub并发送给将密钥放在服务器(vps)上的开发人员,以便我可以克隆存储库。当我创建公钥时,我输入了一个密码。当我尝试克隆时,会发生这种情况:
$ git clone my_app:money_app.git new_money_app
Cloning into 'new_money_app'...
Enter passphrase for key '/c/Users/User1/.ssh/david.pub':
我输入我设置的密码,这行重复了 3 次 Enter passphrase for key '/c/Users/User1/.ssh/david.pub':
然后显示后
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
存储库存在。这是我的配置文件的外观:
Host my_app
User git
HostName xx.xx.xxx.xx
PubkeyAuthentication yes
PreferredAuthentications publickey
IdentityFile ~/.ssh/david.pub
Run Code Online (Sandbox Code Playgroud)
我如何解决这个问题,以便我可以克隆存储库?我对 GIT 完全陌生,是否需要重新创建公钥?我被告知要创建一个公钥,我还需要一个私钥吗?
我是前端开发人员,所以这很令人困惑。
我在我的电脑(ubuntu 16.04)中创建了一个公共ssh密钥,并将其与我的gitlab.com帐户相关联.我用过$ sudo git clone git@gitlab.com:XXXXXX/XXXXXX.git,我有这个错误:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我做了什么:我在我的html文件夹中添加了777 chmod,只使用了命令$ git clone git@gitlab.com:XXXXXX/XXXXXX.git,克隆创建成功.
谁能解释一下我刚刚发生了什么?
亲爱的 StackOverflow 社区,
我按照此(https://gitlab.com/help/ssh/README)指令创建了 ssh-keys。我将 ED25519 SSH 密钥对添加到网页上的 GitLab 配置文件中,如果我这样做,ssh -T git@gitlab.com我确实会收到消息Welcome to GitLab, @username!,到目前为止它似乎有效。
但是,我想git push从git pull本地存储库到 GitLab,而无需每次都输入密码。据我了解 SSH 密钥,这应该正是他们所做的,对吧?
编辑:
我的.ssh/config包含:
Host machine
User username
HostName machine.webside.com
Run Code Online (Sandbox Code Playgroud)
其中.gitconfig包含:
[user]
name = John Doe
email = john.doe@email.com
Run Code Online (Sandbox Code Playgroud)
并且.git/config包含:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://gitlab.com/johndoe/projectname.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = …Run Code Online (Sandbox Code Playgroud) 如何知道SSH密钥的长度?
我git pull最近收到以下错误,
$ git pull
> GitLab: Your SSH key must be at least 2048 bits.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
以前一切正常。
不是猜测(或试错)哪个密钥是罪魁祸首,是否可以列出我所有的 SSH 密钥长度?
更新:
只是git pull给了我上面的错误。即,我的公钥仍然很好:
$ ssh -T git@salsa.debian.org
Welcome to GitLab, @myid-guest!
Run Code Online (Sandbox Code Playgroud)这ssh-keygen -lf可能不是答案,因为我正在关注https://docs.gitlab.com/ee/ssh/,他建议将其ed25519用作默认密钥,并且还指示生成新的 ED25519 SSH 密钥对,做ssh-keygen -t ed25519 -C "email@example.com"。然而,我的ssh-keygen -lf报告说
$ ssh-keygen -lf id_ed25519.pub …Run Code Online (Sandbox Code Playgroud)我有时在尝试 ssh 到主机时会看到此问题。最常见的是通过 git 时(因为我使用 git 进行 ssh 的频率比直接进行 ssh 的频率更高)。
ssh 的输出如下所示:
Received disconnect from <server ip> port 22:2: Too many authentication failures
Disconnected from <server ip> port 22
Run Code Online (Sandbox Code Playgroud)
我还使用了 SSH 代理,在这种情况下,输出如下所示:
Received disconnect from UNKNOWN port 65535:2: Too many authentication failures
Disconnected from UNKNOWN port 65535
Killed by signal 1.
Run Code Online (Sandbox Code Playgroud)
从错误消息的表面来看,我的帐户似乎已被锁定 - 也就是说,如果您多次错误地输入密码,通常会发生什么情况。但我只使用 ssh 密钥进行身份验证,并且这在几天前就有效了。
查看详细输出(使用 ssh -v),我没有看到更多有帮助的信息,但它确实告诉我,它已尝试使用IdentityFile我的文件中为此主机模式配置的所有 s.ssh/config以及中可用的所有身份我的 ssh 代理。
由于我们每季度进行密钥轮换,我最近向代理添加了新密钥。