Permission problems with Git sharedRepository

时光总嘲笑我的痴心妄想 提交于 2019-11-28 09:23:46

问题


I am using Gitolite to manage my git repositories. And I also use a third-party web application to display the repositories.

However each time I do a git push --all git@myserver.com:myproject the third-party web application can not have access to the repository files. So I need to run each time chmod go+rx -R /path/to/the/repository/folder to see the repository.

I have set git config core.sharedRepository all but still is not remembering the permissions after git push.

How can I solve this problem?


回答1:


You could define a hook to your gitolite environment in order to update a non-bare pos (with the right ACL) from your bare repo managed by gitolite.

As long as you don't use the update hook (in Gitolite V3), you can define an post-receive hook in which you would do those tasks.

That being said, check also if the variable REPO_UMASK UMASK in your gitolite.rc has any bearing on this issue:

$UMASK, octal, default 0077

The default UMASK that gitolite uses makes all the repos and their contents have rwx------ permissions.
People who want to run gitweb realise that this will not do.
The correct way to deal with this is to change this variable to 0027 (which gets you rwxr-x---), then add the apache or httpd user running the webserver as a member of the 'gitolite' group.

Please note the syntax; the leading 0 is required. If you change it after the install is complete, you'll have to do some chmod's also to adjust permissions of files and directories that have already been created.

(Note: REPO_MASK got UMASK with GitoliteV3 or 'g3')



来源:https://stackoverflow.com/questions/5455070/permission-problems-with-git-sharedrepository

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!