Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe for multiple users to use a Git repo on a shared network drive?

We're using Eclipse (with the eGit plugin) and I want to host a repo on a shared network drive that several users have write access to.

Can users all point at the same original repo (on the shared drive) or would it be better for each user to clone the repo to their local drive, work off this local version, and push changes to the networked original as required?

Eclipse seems to allow you to "import" (to your Eclipse workspace) a project from a Git repo, but that imported project doesn't seem to be monitored by Git until you choose to "Share project". At this step the working directory becomes that of the repo's working dir for that project. Presumably all users sharing this project would have the same working dir i.e. that of the repo on the shared drive.

I am not clear on the implications of this, but it doesn't seem like a good idea, on first inspection! How will it handle basic problems like 2 users trying to open the same file for editing simultaneously, for instance?

Thanks.

like image 658
Geeb Avatar asked Mar 27 '12 13:03

Geeb


People also ask

Can multiple people own a GitHub repo?

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.

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.


1 Answers

It's better that each person has their own repo.

Clone you current repository as a bare repo and place it on the network drive.

e.g.

git clone --bare /path/to/current/cool_project cool_project.git  

Move the cool_project.git to your network drive, and get everyone to clone from that. Bare repos don't have a working directory, hence the name, so they are safe to push to.

See the chapter 4 of the Git Pro book - Git on a Server, and specifically chapter 4.2 for more details.

like image 184
Chilledrat Avatar answered Sep 16 '22 14:09

Chilledrat