Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: repo for multiple users on a server

I created a Git repo on a server and want it to be used by several people, i.e. users which belong to the same Unix group. It also has a working copy because it may be useful for us to have a common working copy.

Thus I set the owning group of that Git repo directory to that Unix group.

The problem is, every time someone is pushing to that repository, the new files/directories have the owner set to the username of that user and his group but not our common group. Also, all those new files/directories become rwxr-xr-x.

I tried git config core.sharedRepository group but that doesn't really work. It now makes files/directories as rwxrwsr-x but is has still the wrong group set.

like image 784
Albert Avatar asked Dec 02 '10 13:12

Albert


People also ask

Can 2 people own a GitHub repository?

Repositories owned by personal accounts have one owner. Ownership permissions can't be shared with another personal account. You can also invite users on GitHub to your repository as collaborators.

Can a repository have multiple owners?

You can only add collaborators to your repository. It cannot be "co-owned". The only way for doing what you want is to fork the repo and collaborate through pull requests. Note that you can create an organization ( https://github.com/account/organizations/new ) and achieve a bit of what you want.

How do I create a shared repository in Git?

Basic Commands/Actions Make a copy of someone else's GitHub repo in your own GitHub account. Make a copy of the your GitHub repo on your local computer. In CLI: 'git clone' copies a remote repo to create a local repo with a remote called origin automatically set up. You incorporate changes into your repo.


2 Answers

Ok, figured it out.

The first important thing (which I did already) was:

git config core.sharedRepository group

The second one was this:

chmod g+s -R .
like image 134
Albert Avatar answered Oct 02 '22 12:10

Albert


I would highly recommend you use gitolite for any rights management within an organization and git. This has made management of the repos so much easier.

like image 32
Adam Dymitruk Avatar answered Oct 02 '22 14:10

Adam Dymitruk