platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
221 stars 120 forks source link

How to specify a key other than .ssh/id_rsa.pub? #44

Closed robertDouglass closed 10 years ago

robertDouglass commented 10 years ago

It seems that Platform is missing a flag to specify what public key to use? Or is it an undocumented feature?

robertDouglass commented 10 years ago

For example: let's say you have a dozen public/private keypairs, and you use one called platform_rsa.pub that is stored in the ~/development/.ssh folder on your machine; how do you tell the CLI that this is the key that is supposed to be used when authenticating you?

robertDouglass commented 10 years ago

For example, the ssh command has this parameter:

-i identity_file Selects a file from which the identity (private key) for public key authentication is read. The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/id_rsa for protocol version 2. Identity files may also be specified on a per-host basis in the configuration file. It is possible to have multiple -i options (and multiple identities specified in configuration files). ssh will also try to load certificate information from the filename obtained by appending -cert.pub to identity filenames.

kotnik commented 10 years ago

This can not be done, and wrapping git calls with ssh-agent calls would not be nice.

One must add the key one wants to use to the ssh-agent. People using multiple keys are used to that. Two solutions:

1) Add specific key to the SSH agent prior any command:

ssh-add /path/to/the/key

2) Strictly define host in ~/.ssh/config, example for eu.platform.sh:

Host *.eu.platform.sh
    IdentityFile /path/to/the/key