DEV Community

Discussion on: ssh - a treat for your GitHub

Collapse
 
ferricoxide profile image
Thomas H Jones II

An easier method for copying your public key to a remote host is to use the ssh-copy-id command.

Also, if you have multiple SSH keys on your keyring, you can create scenarios where the git-remote will give you a "too many authentication failures" error due to the ssh-agent presenting the wrong key(s) prior to the correct key.

Collapse
 
krzysztow profile image
Krzysztof

I do second ssh-copy-id. Got to know about it few weeks ago and it's such a helper!

Collapse
 
dlintott profile image
Daniel Lintott

Using the SSH config file (~/.ssh/config) can come in handy here.

Specify the remote server you are connecting to using the Hoststatement.

Within the host statement you can specify the options that differ from the defaults for that host including but not limited to username and identity.

Host example.com
    User fred
    Identity File ~/.ssh/example-key

Then when you connect to the example.com server it will use the options you have specified. On some OSes this also provides auto-completion for the SSH command.

The SSH Config Man page has all the options you can specify linux.die.net/man/5/ssh_config