多个github帐户多个ssh键

发布于 2025-02-04 12:11:19 字数 1080 浏览 3 评论 0原文

我有两个GitHub帐户,一个是工作,另一个是个人的。我已经生成了两个RSA密钥,并将这些RSA放在受人尊敬的帐户上。这些工作正常

,但是每次我都必须运行此命令ssh-add〜/.ss/my_workssh-add〜/.sss/my_personal

我的问题为什么我的问题就是我一旦我打开新的终端并拉/推东西,就必须每次运行此ssh-add命令吗?

我试图通过更新〜/.ssh/config文件来解决它,但是它不起作用,我在stackoverflow上找到了很多解决方案,但是这些解决方案尚未解决,但

我遵循了这一点:

不得不运行<代码> ssh-add 命令添加存储库的SSH私钥?为什么它不容易添加?

对于一个reop,它不需要运行ssh-add命令,而是另一个回购,始终必须运行,否则,我也会得到以下错误:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我也遵循了这一点:多个github帐户&amp; ssh config

情况是相同的,只有在我运行eval时才起作用。

有人可以帮我完成吗?问题是什么?为什么我每次都必须添加ssh-add命令为另一个存储库?

I have two github account, one for work and another personal. I have generated two rsa key and put those rsa to the respected account. these are working fine

But everytime I had to run this command ssh-add ~/.ss/my_work or ssh-add ~/.sss/my_personal

My questions is why I have to run this ssh-add command every time once I open new terminal and pull/push something?

I tried to solve it by updating ~/.ssh/config file but it doesn't work, I found lots of solution on StackOverflow but those are not solved my cases

I followed this: https://gist.github.com/alejandro-martin/aabe88cf15871121e076f66b65306610

Yet, I had to run ssh-add command to add the ssh private key of the repo? why it is not adding permantly?

For one reop, it doesn't requires to run ssh-add command but another repo, always had to run, otherwise, I am getting following error:

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I followed this too: Multiple GitHub Accounts & SSH Config

The situation is same, they work only when I run eval "$(ssh-agent -s)" and then ~/.ssh/my_work

Can anyone please help me to get it done? what is the problem? why I have to every time add ssh-add command for another repo?

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

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

发布评论

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

评论(1

不羁少年 2025-02-11 12:11:19

我的问题是,为什么我每次打开新终端并拉/推东西时都必须运行此SSH-ADD命令?

仅当您创建了加密的私钥(由密码保护)时,才需要此。

如果您在创建上述密钥时没有输入密码,则根本不需要ssh-agent

而且,如果您需要ssh-agent,则可以在打开会话时输入一次密码,然后为您的后续推送/拉/克隆操作打开该会话。不必再次输入密码,因为在该会话中,ssh-agent会缓存所述密码。

您可以自动化启动ssh-agent

My questions is why I have to run this ssh-add command every time once I open new terminal and pull/push something?

You need this only if you have created encrypted private keys (keys protected by a passphrase).

If you did not enter a passphrase when creating said keys, you would not need ssh-agent at all.

And if you need ssh-agent, you could enter your passphrase once when opening your session, and then keep that session open for your subsequent push/pull/clone operations. Without having to enter the passphrase again, since, in that session, the ssh-agent would have cached said passphrase.

You can automate launching the ssh-agent.

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