错误致命:无法从远程存储库中读取。 ``$ ssh -add -l -e sha256`代理没有身份。

发布于 2025-02-10 03:47:47 字数 734 浏览 2 评论 0原文

通过笔记本电脑上的Vscode连接我的github,我有一个问题。我还读过其他相关问题a>和 this 没有运气(我从头开始创建了一个新密钥)。我已经遵循与ssh 多次成功(以防万一生成新密钥)。我的问题是当我试图推动时。我遵循说明在这里。一切正常工作,直到$ ssh -add -l -e sha256我收到的错误消息是代理没有身份。可能是因为我已连接到另一个不同GitHub帐户之前(我有两个)?我创建了一个新键,因此从理论上讲,它们应该与众不同。

I have an issue connecting my github through VScode on my laptop. I have read other relevant questions like this and this with no luck (I created a new key from scratch). I have followed all steps for connecting to github with SSH succesfuly multiple times (generated new keys just in case). My problem is when I am trying to push. I followed instructions here. Everything works fine up until $ ssh-add -l -E sha256 The error message I get is The agent has no identities. Could it be because I was connected to a different github account previously (I have two)?I created a new key so in theory they should be different.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

停顿的约定 2025-02-17 03:47:47

这些方向有些误导。他们告诉您要验证您的密钥在代理中,而不告诉您如何首先将其添加到代理商中。 (实际上,他们这样做了,但是在单独的页面。)您需要运行一个命令ssh-add〜/.ssh/my_key首先要填充代理。 (每次您启动新代理时,都需要重复此操作;用于自动填充用钥匙链中的键的代理的技术超出了此答案的范围。)

我不为代理而烦恼。相反,我将类似以下内容添加到我的SSH配置文件中。

Host github.com
    User git
    IdentityFile ~/.ssh/my_key

然后,ssh而不是需要查找IdentityFile指定的文件,而不是需要查找活动代理。

(如果将密码添加到密钥中,则代理很方便,因为在将密钥添加到代理中时,您只会提示您的密码,而不是每次ssh尝试使用键。)

The directions are somewhat misleading. They tell you to verify that your key is in the agent without telling you how to add it to the agent in the first place. (Actually, they do, but on a separate page.) You need to run a command like ssh-add ~/.ssh/my_key first to populate the agent. (This needs to be repeated every time you start a new agent; techniques for automatically populating an agent with keys stored in a keychain are beyond the scope of this answer.)

I don't bother with an agent. Instead, I add something like the following to my SSH configuration file.

Host github.com
    User git
    IdentityFile ~/.ssh/my_key

Then, instead of needing to look in an active agent, ssh simply looks for the file specified by IdentityFile.

(If you add a passphrase to your key, the agent is convenient because you will only be prompted for the passphrase when you add the key to the agent, not every time ssh tries to use the key.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文