git - Understanding ssh-keygen for SSH'ing into a server vs accessing GitHub -


so understanding ssh-keygen 1 of many commands provided openssh.

when generating private/public key pair using ssh-keygen, know can put public key onto remote server (inside ~/.ssh/authorised_keys) , it'll allow ssh server.

but seems there 2 different ways of generating key pair though, in sense can use ssh-keygen alone, , when cat public key you'll see like:

ssh-rsa xxxx user@computername 

where user@computername looks m@marks-mbp.default me.

the other way using -c comment flag (github suggests doing this). seems it'll not use user@computername email address instead in place (or whatever 'comment' happen use).

am right in thinking ssh'ing server, username use login whatever -c comment set in public key?

so if don't use -c @ all, it'll generate public key m@marks-mbp.default @ end. assume username m.

but if use -c "bingbop", assume username ssh bingbop.

is correct?

also, there technical reason github suggest using -c specify email address rather leaving flag off?

i'm guessing when try clone or push repo (using git@github.com:<user>/<repo>.git protocol) can't identify public key alone, needs comment set github email address

am right in thinking ssh'ing server, username use login whatever -c comment set in public key?

no. key's comment field that: (optional) comment, convention set email address, happens default user@host if not specified.

the username use when logging in via ssh not related or derived comment field.

also, there technical reason github suggest using -c specify email address rather leaving flag off?

yes, reason being default of user@host provides useful information give public key to. email address on other hand more valuable information.

i'm guessing when try clone or push repo (using git@github.com:/.git protocol) can't identify public key alone, needs comment set github email address.

github can identify provided key alone unique across github users. in uri syntax you've given, git before @ username provided ssh. github uses generic username of git users, , individual users identified key provide.


Comments