0

I created a second user account on my computer, when I was releasing an app under a different developer account, as I understood this was preferable in terms of keys for the certificates.

However, now when I wish to implement source control with Github in my apps on the second account, I'm having difficulty, I suspect because the SSH key was generated with my normal account.

Has anybody else faced this situation, advice? Am I supposed to create another SSH key or something?

Martin Buberl
  • 45,844
  • 25
  • 100
  • 144
Alan
  • 4,325
  • 3
  • 21
  • 25

3 Answers3

4

You should create one ssh key per user per computer. You can easily add multiple keys to your github account.

Just do ssh-keygen, follow the prompts, then cat ~/.ssh/id_rsa.pub and copy the result into github on the account preferences page under SSH keys.

If you don't know the location of the file, enter ~/.ssh/id_rsa for your private key and ~/.ssh/id_rsa.pub for your public key.

Peter
  • 127,331
  • 53
  • 180
  • 211
  • Okay thanks, just to note, your "follow the prompts" instruction obviously assumed that I would know to name the file id_rsa.pub and to save it in that directory. This was not the case! Can you please update the answer to include this info and I will give you a tick, thanks. – Alan Jan 16 '13 at 23:32
  • Did ssh-keygen not prompt you to have that as its default? If you just hit enter on ssh-keygen it should start with that as the default. Happy to update, just want to clarify first. – Peter Jan 17 '13 at 04:52
  • It didn't mention any default for me no, just asked for a file name, good to know that enter trick for future reference. – Alan Jan 17 '13 at 08:37
1

You can associate more than one key with your Github account, and if I understand your question that's one approach (one key for each user on your computer). You could also share the one private key between both accounts.

pjmorse
  • 9,204
  • 9
  • 54
  • 124
0

I believe it's better to copy the original key pair to the second account, if both accounts are intended to be used as a 'single identity'. If you later start using ssh key authentication for other purposes (other hosting, ssh to your other work machines), it's simpler if you don't need to import several different keys to all the machines but just one key.

See Is it possible to use the same ssh private/public key pair on 2 machines to access a git repository?

Community
  • 1
  • 1
Kalle Pokki
  • 4,939
  • 2
  • 17
  • 18
  • OTOH I like the comfort of being able to cut access from one specific device without regenerating keys on all others. – Kos Jan 15 '13 at 19:58
  • Depends on the case. It is of course wise to have different home and work ssh keys, but if you for example have three workstations under your desk at office, it might be more convenient to clone the keys among those computers. – Kalle Pokki Jan 15 '13 at 20:04