开发者

gitolite + cgit: No repositories found

开发者 https://www.devze.com 2023-03-05 02:12 出处:网络
I\'ve set up and configuered gitolite and wish to configure the cgit web interface to it. Problem: When browsing a directory using cgit I ge开发者_运维问答t the error:

I've set up and configuered gitolite and wish to configure the cgit web interface to it.

Problem:

When browsing a directory using cgit I ge开发者_运维问答t the error:

No repositories found

Setup

When a new repository is created gitolite creates a corresponding directory to it under /home/git/repositories automagically. cgit is configuered to read these repositories using:

project-list=/home/git/projects.list 
scan-path=/home/git/repositories

The problem is that these repositories doesn't seem to be bare repositories. If I instead manually clone one of these repositories using

git clone --bare user@server:repo

it seems to work. I really don't want to do this manually every time a new repository is checked in. Why aren't the repositories created by gitolite bare already? How can I automate this?


Turns out - after trying to verify it several times - this is just a file system rights issue. After trying

chown -R www-data:www-data repositories/repo

to force ownership into my apache user running cgit, the repository shows up in the web interface.

The proper solution is to add the apache user to the git group and change the value umask in .gitolite.rc to

$REPO_UMASK=0027

Note: with Gitolite V3 or 'g3', that would be (see doc):

$UMASK=0027


It was similar with permission issue i encountered before. I used a scripts to fix permission of git repositories.

script: fix_perm_cgit.sh

#!/bin/sh
reponame="$1"
if [ ! -d "$reponame" ]; then
   echo "missign repo_name"
   exit 1
fi


find "$reponame" -type d | while read fn ; do chmod og+rx $fn ; echo "d-> $fn" ; done
find "$reponame" -type f | while read fn ; do chmod og+r $fn ; echo "f-> $fn" ; done
0

精彩评论

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

关注公众号