osx ssh/得到错误的密钥?

发布于 2024-10-23 16:27:01 字数 474 浏览 2 评论 0原文

在某个时候,我创建了一个密钥,我创造性地将其命名为 publickey。

我现在不知道它在哪里,也不记得如何设置 git 来使用它。

但是当我尝试使用 ssh 时,我得到:

mymac:joyent aaa$ git push mysite

Permission returned (publickey).

我已按照 github 指南设置新密钥: http://help.github.com/mac-set-up-git/

我根据我制作的新 id_rsa 密钥设置远程密钥信息。

但每当我尝试推动时,我最终都会使用旧的公钥。即使是本地提交也是由错误的用户进行的。

如何扔掉旧钥匙并使用新钥匙?

At some point I have created a key which I creatively named publickey.

I don't know where that is now and I can't remember how I set git to use it.

But when I try to use ssh I get:

mymac:joyent aaa$ git push mysite

Permission denied (publickey).

I've followed the github guide to set up new keys:
http://help.github.com/mac-set-up-git/

I set my remote key information based on that, the new id_rsa key I made.

But whenever I try to push I end up using the old public-key. Even commits locally are with the wrong user.

How do I get rid of my old key and use my new one?

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

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

发布评论

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

评论(2

智商已欠费 2024-10-30 16:27:01

即使是本地提交也是由错误的用户进行的。

这与 ssh 无关。查看 /Users/harry/.gitconfig 以设置用户名。

并查看此常见问题解答,了解如何显式设置要使用的 SSH 身份。

Even commits locally are with the wrong user.

That is not ssh related. Look at your /Users/harry/.gitconfig to set the username.

And look at this FAQ about explicitly setting which SSH identity to use.

浅紫色的梦幻 2024-10-30 16:27:01

如果您使用 github 设置了新密钥,我会说一些您可能已经意识到的事情,但至少我们都会知道您所在的位置。

生成密钥时,您应该获得一个私钥,例如 id_rsa 和一个公钥 id_rsa.pub (即您传递给 github 的密钥)

您的 git 本地副本可能会从 ~/.ssh 检索密钥(除非配置)否则)

您看到的 publickey 错误并不一定意味着该密钥被命名为 publickey 因为我相信这是一个标准错误

所以我猜 git 没有使用您的旧密钥,它只是您当前的密钥有问题。因此,您应该检查它是否在写入位置 ~/.ssh 中,并且 ~ 是 git 所期望的,尽管您在 mac 上工作,所以应该是这样,并检查您是否已将公钥正确复制到 github,您需要粘贴整个文件

编辑:

您可以测试您的密钥

ssh [email protected] 

如果密钥设置正确,它应该说您已通过身份验证可以使用

I will say a few things you might already have realised if you have set up a new key with github but at least we will both know where you are at.

When generating a key you should get a private key, for example id_rsa and a public key id_rsa.pub (thats the one you pass to github)

Your local copy of git will probably be retrieving the key from your ~/.ssh (unless configured otherwise)

The publickey error your seeing doesn't necessarily mean the key is named publickey as I believe this is a standard error

So I would guess git isn't using your old key it's just got a problem with your current key. You should therefore check it is in the write location ~/.ssh and that the ~ is the ~ git is expecting, though you are working on mac so it should be and check you have copied your public key to github correctly, you need to paste the whole file

EDIT:

You can test your key with

ssh [email protected] 

And it should say you are authenticated to use if the keys are set up correct

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