Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make my local Git repository accessible for multiple users?

I want to create a git repository and allow all users to have access to it. I tried initializing it by:

git init --shared=all 

However when I change the user and do a git status, I get the following error:

fatal: Unable to create '.git/index.lock': Permission denied

Is this supposed to happen? I access the repo on my local file-system and not via SSH.

like image 295
12345 Avatar asked Dec 06 '10 18:12

12345


People also ask

How do I share a Git repository with multiple users on a machine?

You assign the group using the chgrp command. For a new repo it is git init --bare --shared=group myproj where myproj is your repo name, followed by chgrp -R mygroup myproj where mygroup is your group name.

How do I share a Git repository to another user?

Under your repository name, click Settings. In the "Access" section of the sidebar, click Collaborators & teams. Click Invite a collaborator. In the search field, start typing the name of person you want to invite, then click a name in the list of matches.

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.


1 Answers

Apparently, --shared={all|world|everybody} is broken in recent Git. Use octal permissions:

git init --shared=0777
like image 141
Fred Foo Avatar answered Sep 22 '22 01:09

Fred Foo