Frage

So this is how I set up my project:

git init --bare

Later I learned that if you want to work on a project with multiple users this is how I should have done it:

git init --bare --shared

Now I tried to work like that and luckily we are in the beginning so I could set up git again. I still wonder though when you're in the middle of a project you can't do that. Is there a way that i can change a bare repo to a shared one?

War es hilfreich?

Lösung

Since the --shared option just sets the permissions on everything in the repository to group-writable you could do this manually later:

$ chmod -R g+w the/repo/path

Plus, add

sharedrepository = 1

under the [core] section in .git/config. Shared repos also have the following receive option defined by default (which you may or may not want):

[receive]
    denyNonFastforwards = true

Note: In order to decide whether you want denyNonFastforwards: This option means a merge never happens in the shared repository, which, in turn, means there is never a merge conflict on the shared repository. Instead the push is rejected forcing the user to do the merge in their local repository where it's much easier to fix and where it doesn't interfere with other people's use of the shared repo.

Andere Tipps

Besides chmod -R g+w, you also need to edit (.git/)config and set core.sharedRepository = .... For ..., there are a handful of values, described in git-init(1).

Probably if you try to share an existent repository, you may have lots of different users commits.

1.If you have super user permission, you can go forward and change all permissions by yourself using the step two, in any-other case you will need to ask all users with objects created with their users, use the following command to know who they are:

$ ls -la | awk '{print $3}' | sort -u 
<your user_name>
<his user_name>

2.Now you and all file's owner users will have to change those files permission, doing:

$ chmod -R 774 .

3.After that you will need to add a new property that is equivalent to --shared=group done for the new repository, according to the documentation, this make the repository group-writable, do it executing:

$ git config core.sharedRepository group

If you're trying to share the repository off of the the host it is on, there are additional configuration steps you have to make (ssh stuff).

http://shapeshed.com/setting_up_git_for_multiple_developers/

http://www.jedi.be/blog/2009/05/06/8-ways-to-share-your-git-repository/

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top