1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.