Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to create a shared team repository using Git in my machine (ubuntu 10.4), so our team can clone the code and pull/push etc...

But I found it seems I need to create ssh account for it. I am not familiar with the security of linux, so I wonder how to control the access right for this account. Say, I hope this ssh account only can access the git directory (read and write), for example, /home/camino/myproject, and any access to all the other directory should be denied.

Is it possible?

Thanks in advance for your help.

share|improve this question

migrated from stackoverflow.com Sep 29 '10 at 17:30

This question came from our site for professional and enthusiast programmers.

    
Setting up ssh accounts for all the users is indeed the best and easiest way to do this. I voted to move this question to superuser. –  kubi Sep 28 '10 at 9:34
    
thanks a lot :) –  camino Sep 29 '10 at 3:25

2 Answers 2

up vote 1 down vote accepted

This is what Gitosis solves. The solution is a single user account (call it 'gitosis'), public-key access to it over ssh, and gitosis in the background checking those credentials per a configuration file.

share|improve this answer
    
Absolutely gitosis. You don't need to (or even want to, most likely) create user accounts for each person. gitosis lets you configure your git server using git. It's fantastic. –  Graham Perks Sep 29 '10 at 1:11
    
thanks a lot for your suggestion,I'll try it :) –  camino Sep 29 '10 at 3:22

You can create user accounts on your box for your co-workers. By default they should not be able to access your local home directory. You can verify this by checking the file system access setting on /home/user (replace 'user' with actual user name)

drwxr-x--- 143 user user 8.2K 09-28 14:45 /home/user/

Here is a basic outline of what you should do:

  1. Create a new group named 'git'
  2. Add 'git' group to your current user name
  3. Create a new user account for each user and add 'git' to there group list
  4. Create a new directory tree from / where your git repo's will be stored
  5. Make sure the directories can be accessed by your 'git' user group
  6. Clone your working repo to a bare one, and push to the shared repo using ssh:

    git clone --bare ~/proj proj.git
    scp -r proj.git server:/git/USER/
    
  7. Add the shared repo to your working git project, so you can push/pull.

    git remote add origin ssh://HOSTNAME/git/USER/proj.git
    git config branch.master.merge refs/head/master
    

From this point, your remote users should be able to access your machine, login and clone the shared repo. They can also push/pull changes.

share|improve this answer
    
thanks a lot for your detail steps :) –  camino Sep 29 '10 at 3:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.