Import SSH key
1. Place the private key in the correct directory
By default, SSH looks for keys in ~/.ssh/
- Open Terminal and run:
- Move your
id_rsaandid_rsa.pubfiles into the~/.ssh/directory. For example:
- Set the correct permissions:
2. Add the key to the SSH agent
macOS uses ssh-agent to manage SSH keys.
If you want the key to be remembered even after restarting, you can use the macOS Keychain:
Start the agent and add the key:
3. (Optional) Add host configuration in ~/.ssh/config
To simplify connections to specific servers using your key, you can create or edit the ~/.ssh/config file:
Example entry: