多个github帐户多个ssh键
我有两个GitHub帐户,一个是工作,另一个是个人的。我已经生成了两个RSA密钥,并将这些RSA放在受人尊敬的帐户上。这些工作正常
,但是每次我都必须运行此命令ssh-add〜/.ss/my_work
或ssh-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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅当您创建了加密的私钥(由密码保护)时,才需要此。
如果您在创建上述密钥时没有输入密码,则根本不需要
ssh-agent
。而且,如果您需要
ssh-agent
,则可以在打开会话时输入一次密码,然后为您的后续推送/拉/克隆操作打开该会话。不必再次输入密码,因为在该会话中,ssh-agent
会缓存所述密码。您可以自动化启动ssh-agent 。
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, thessh-agent
would have cached said passphrase.You can automate launching the ssh-agent.