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?
Specify that the Git repository is to be shared amongst several users. This allows users belonging to the same group to push into that repository. When specified, the config variable "core. sharedRepository" is set so that files and directories under $GIT_DIR are created with the requested permissions.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With