Search code examples
gitgitosisssh-keys

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


I've recently setup an inhouse git repository server and have it up and running with gitosis installed as the management tool. Read only access is available via the git:// protocol and write access is available via gitosis using ssh public keys.

I have a developer that has been granted access to his projects with a public key that was generated on his desktop workstation.

He is now wanting to access that repository from his laptop using the same ssh key pair. He's copied has .ssh folder in it's entirety to his laptop and has tried to clone from the repository without success.

Is this a valid thing to try?

Does a ssh key pair need to be generated per machine? This seems weird as it would effectively require a per machine username to be added to the gitosis configuration.

Any help would be appreciated.


Solution

  • Yes I think you can.

    I have something similar. Two machines, one Intel (desktop) the other one Sparc. I can log into both machines and access the same CVS server (another machine) using SSH access with the same key pair which was generated on the Intel machine.

    Make sure when you copy across your private key that you set both the permissions of the .ssh directory correctly (0700) and your home directory cannot be group or world writable. The id_rsa should only have user read access (0400)