6

I have multiple computers working on the same project, and I'm using a free assembla git repo account to manage all this.

In order to access the git repo, I need to generate unique SSH keys on each computer. However, a computer might be working on other assembla projects as well, so there seems to be a conflict whenever I generate a new ssh key (like I have to keep replacing the id_rsa files). Once I recreate the id_rsa files (and replace them) on a local machine, it loses access to the previous assembla git projects using the previously-generated ssh key.

I'm fairly new to the whole git business, and trying to learn as I go.

I found something that sounded like a solution to my problem: "Different SSH keys for different projects" http://www.assembla.com/spaces/breakoutdocs/wiki/Different_SSH_keys_for_different_projects

However, I don't understand how to do #1? It says to "place somewhere in $PATH this script (let its name will be gitssh)", but I don't know what/where "$PATH" is?

Any help would be greatly appreciated. Thanks!!

Jay
  • 1,084
  • 4
  • 18
  • 43
  • Why do you need to create unique ssh keys again? I have several work laptops and I have the same key on all of them. If a laptop get stolen I simply remove the key from the remote server (or request it if someone else is maintaining it.) If Assembla requires a different key per project, try uploading the same key. If this doesn't let you I would dump Assembla. And go with another provider or roll your own with Gitolite. – Mauvis Ledford Nov 17 '11 at 18:58

1 Answers1

6

You can create as many public/private ssh key as you want.
Simply don't use the default names id_rsa and id_rsa.pub.

However, not using the default naming convention means ssh, by default, won't find your keys.
You need to define in your ~/.ssh directory a config file, where you will indicate what private key to use:

Host myproject1
    HostName server1
    IdentityFile ~/.ssh/project1.rsa
    User username

You can then push to myproject1 if you have added myproject1 as a remote.
See also "Unable to Git-push master to Github" for ssh troubleshooting, and "Specify an SSH key for git push without using ~/.ssh/config" for adding your ssh address as a remote.

You can add to the ~/.ssh/config file as many address as you need, each one referring a private key that you can name as you want.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Had to play around with it a bit, but after going through the links you mentioned as well, got it to work! Thank you!! – Jay Nov 18 '11 at 00:06
  • Another link I used for a reference: http://osxdaily.com/2011/04/05/setup-ssh-config-fie/ (to create the config file) – Jay Nov 18 '11 at 00:32