Migrate SSH keys from Linux to Mac [closed]

2019-05-25 03:28发布

问题:

I've been working with Linux for past month, however there are factors that force me to use a Mac (OS X 10.8.3) for my further work. I had my Linux station fully set up, including the SSH keys and in order to allow access for my Mac as well, I thought I'd copy the keys from my Linux machine to the Mac.

What I did was: Compress the ~/.ssh folder on Linux; transfer the archive to the Mac; extract the contents to ~/. I now have the four files in my Mac's ~/.ssh (config, xxx.pub, xxx and known_hosts).

However I don't think the keys are recognized by the system, as I cannot clone from bitbucket or our local hg server.. Are you supposed to somehow initialize the keys or as I have custom names for my keys, enter the names somewhere? I would greatly like to avoid the trouble of generating new keys and giving them to our sysadmin.

回答1:

Turns out all I had to do is

ssh-add -K ~/.ssh/name_of_the_key

Maybe next time it will appear higher in the google for others with a similar problem to find :)