Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the right group rights on a git remote repo

Tags:

git

I've got a git remote repo at my server. Everytime I push my local branch to the server the files in ~/objects have just the rw permissions for my specific account(not my group – git). So when my friend does a push concerning those files in ~/objects hes getting a rights-permission error.

Hes in the same group: git, but of course does not have the rights to write (because the group git has'nt)

How do I tell git to give those files the right rights to the whole git-group ?

Thanks for your help.

_christoph

like image 561
wuschelhase Avatar asked Oct 15 '10 22:10

wuschelhase


People also ask

How do you fix Please make sure you have the correct access rights and the repository exists?

The “Please make sure you have the correct access rights” error occurs if you do not have the right permissions to access a Git repository. To solve this error, make sure you are referring to the correct remote URL and that you have set up SSH authentication correctly.

How do I change the permissions on a collaborator in GitHub?

Changing permissions for a team or personUnder your repository name, click Settings. In the "Access" section of the sidebar, click Collaborators & teams. Under "Manage access", find the team or person whose role you'd like to change, then select the Role drop-down and click a new role.

How do I change my rights in GitHub?

Select the GitHub App whose permissions you want to change. In the left sidebar, click Permissions & webhooks. Modify the permissions you'd like to change. For each type of permission, select either "Read-only", "Read & write", or "No access" from the dropdown.


2 Answers

From git-config(1):

  • core.sharedRepository
    When group (or true), the repository is made shareable between several users in a group (making sure all the files and objects are group-writable). […]

Do this on the server:

  1. Configure the repository for group sharing.
    This will effectively forcibly widen the umask for future Git operations.

    cd /path/to/repository.git
    git config core.sharedRepository group
    
  2. Cleanup the existing permissions:

    chgrp -R git .
    chmod -R g=u .
    
  3. Force group owner inheritance for new entries (not needed on BSD-style systems, but usually needed on other systems):

    find . -type d -print0 | xargs -0 chmod g+s
    
like image 170
Chris Johnsen Avatar answered Oct 05 '22 03:10

Chris Johnsen


I recommend that you have your developers use a common user account when connecting to the remote repo server that you operate. You can manage access via SSH keys so you don't have to worry about distributing/sharing passwords, etc.

If you want to stick with using separate user accounts, then this question was answered well over at serverfault: https://serverfault.com/questions/26954/how-do-i-share-a-git-repository-with-multiple-users-on-a-machine

You might want to look into using gitosis for running your own repo: http://eagain.net/gitweb/?p=gitosis.git

Good gitosis setup instructions are available at http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way.

like image 22
Eric Dennis Avatar answered Oct 05 '22 03:10

Eric Dennis