开发者

Change GIT repository to shared

Git allows to create a shared repository amongs a group:

git --bare init --shared=group开发者_Go百科

However - how can I change already existing repository to shared? I don't want to re-git-init it.


According to the documentation:

--shared[=(false|true|umask|group|all|world|everybody|0xxx)]

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. When not specified, git will use permissions reported by umask(2).

Therefore, in order to change the permission, chmod everything to your liking, and set the core.sharedRepository in git config accordingly:

git config core.sharedRepository true


To make a private bare repo group shared:

  1. Edit config and add sharedRepository = group to the core section
  2. Fix permissions from inside the repo:
    • chgrp -R target-group .
    • find . -type d | xargs chmod g+ws
    • find refs -type f | xargs chmod g+w
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜