Git repository with multiple users on Ubuntu

10,359

Solution 1

Have him create a ssh keypair and send you the public key.

Add the public key to your ~/.ssh/authorized_keys file, and add the command="..." option to limit it to the git-shell - see this link for an example.

Solution 2

Orip's answer is probably all you need. If you want something a little more automated you might want to look at gitosis

Solution 3

You will also probably want to have both of those users in the same user group, and to make sure you have group-write privileges on the repository.

Share:
10,359
infinigrove
Author by

infinigrove

Updated on June 04, 2022

Comments

  • infinigrove
    infinigrove almost 2 years

    I have an existing bare git repository located in /home/myaccount/git/project. I am currently using it over ssh from my local machine without any problems. I want to add a second user on the server which only shall access to this git repository (maybe move the repo outside my account folder?). How? Using latest version of git and ubuntu on slicehost.

    I have this setup: user: sleepyhead user: developer1 group: git. both sleepyhead and developer1 are members of this group repository /home/sleepyhead/git/project1

    I want to: move repository to a proper place, either /home/git/project1 or /usr/local/git/project1. What is recommended? developer1 should permissions to read and write project1 with git. no other permissions should be given.

    I do not know how to properly set the permissions and to restrict developer1 to only have access using git to project1.

  • infinigrove
    infinigrove over 15 years
    i have updated my question. basically what you are saying is exactly what i want to know how to accomplish