在一台内网服务器上安装 gitlab 4.2 stable, 按照https://github.com/gitlabhq/gitlabhq/blob/4-2-stable/doc/install/installation.md 安装完后,运行 sudo -u gitlab -H bundle exec rake gitlab:check RAILS_ENV=production 全部绿色通过。 启动时/etc/init.d/gitlab 脚本运行有问题,因此改为按 sudo -u gitlab -H bundle exec unicorn_rails -c $DAEMON_OPTS -E production& 启动,启动后页面显示,创建新用户,登录,创建新组织,新项目等均正常。 问题在于: 新建一个名为 test 的项目后,在另一台机器(与服务器处于同一内网)按照 gitlab 给出的 test 项目 ssh 地址,运行 git clone [email protected]:test/test.git 会提示 fatal: 'test/test.git' does not appear to be a git repository 猜测可能是目录位置不对,于是运行 git clone [email protected]:repositories/test/test.git 可以成功 clone(提示 Cloning into 'test'... warning: You appear to have cloned an empty repository.) 但是会出现第二个问题 在 git init 随便 commit 一个文件后 push 回 server 时 会提示 Counting objects: 3, done. Writing objects: 100% (3/3), 197 bytes, done. Total 3 (delta 0), reused 0 (delta 0) remote: Empty compile time value given to use lib at hooks/update line 10 remote: Use of uninitialized value in require at hooks/update line 11. remote: Can't locate Gitolite/Hooks/Update.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at hooks/update line 11. remote: BEGIN failed--compilation aborted at hooks/update line 11. remote: error: hook declined to update refs/heads/master To [email protected]:repositories/test/test.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to '[email protected]:repositories/test/test.git'
我搜索到了 5 个月前的一个类似问题https://github.com/gitlabhq/gitlabhq/pull/1719#issuecomment-9731139 按照@saito的建议,运行 sudo usermod -a -G gitlab git 也没能解决问题
我把 gitlab.yml 中与 gitolite 有关的部分贴出来,请大家帮忙看下有什么问题
gitolite: admin_uri: git@localhost:gitolite-admin
# REPOS_PATH MUST NOT BE A SYMLINK!!! repos_path: /home/git/repositories/ hooks_path: /home/git/.gitolite/hooks/ admin_key: gitlab upload_pack: true receive_pack: true ssh_user: git ssh_host: 192.168.1.254 # ssh_port: 22 # config_file: gitolite.conf
# Uncomment and customize if you can't use the default group to own the repositories and run Gitolite (default: same as the 'ssh_user' above) # owner_group: group123