Create ssh alias without manually editing ~/.ssh/config
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Already using ssh-copy-id? Great! But still manually adding the same configuration info to ~/.ssh/config? No more!

This script creates an alias in ~/.ssh/config based on your input.


$ ssh-save-id

Typical use-case

$ ssh-copy-id   // copies your public-key to the remote host ($ brew install ssh-copy-id)
$ ssh-save-id   // uses the host-part as an alias in ~/.ssh/config
$ ssh                // use the alias to connect to the remote host


Download the script directly from GitHub:

$ curl -O

Then ensure it is executable:

$ chmod a+x ssh-save-id

Drop it in your $PATH OR move it to a default location:

$ mv ssh-save-id /usr/local/bin/ssh-save-id

And test if it works:

$ ssh-save-id -h

Do you see the usage instructions as stated below? Great, start saving time!

Usage instructions

Usage: ssh-save-id [-h|-n] [-p port] user@hostname
-n: dry run    -- no aliasses are actually saved
-h: print this help