7

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.

1
  • Well, you don't need git for this. Just use a normal Network Drive and let all your developers read and write from there. I wouldn't recommend it, as you will end up with many problems, but it's possible. Commented Mar 27, 2012 at 13:13

2 Answers 2

8

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.

1
  • I guess I will have to install msysgit to clone a bare repo, as I am forced to use windows and the eGit plugin doesn't appear to support this feature.
    – Geeb
    Commented Mar 27, 2012 at 16:23
3

From the sound of it you are talking about each user pointing to the git repository over the network and not having individual git repositories on each developer's computers and then pushing to a 'central' repository. If I am correct in reading your question that is not a great way to take advantage of what git has to offer. Git is a distributed version control system so everyone should have their own repository and push the changes to a central repository that you do your CI builds off of.

3
  • @PITaylor OK, so you would recommend first of all each developer cloning the repo from the network drive to his local drive, then working off this cloned version?
    – Geeb
    Commented Mar 27, 2012 at 13:25
  • 2
    There is no other way you should be using git. Sharing the same repo is a disaster waiting to happen. Commented Mar 27, 2012 at 13:33
  • That is exactly how you should be doing it. Github has some fantastic getting started tutorials at help.github.com that apply even if you are not using github.
    – PlTaylor
    Commented Mar 27, 2012 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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