Redmine + Gitolite - 存储库权限等问题 [英] Redmine + Gitolite - Issue with repository permissions and more

查看:107
本文介绍了Redmine + Gitolite - 存储库权限等问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



为了将我的存储库链接到我的Redmine实例,我在本地克隆了带有以下命令:

  git clone --bare --local /home/git/repositories/my-repo.git 

就像我成功克隆服务器上的回购服务器一样,我可以像预期的那样浏览Redmine上的回购。 / p>

事情是,只要我这样做,我就无法再向本地机器上的远程回购站推送任何东西。



当我尝试时

  git push 

我得到以下错误:

 计数对象:15,done 。 
使用多达4个线程的增量压缩。
压缩对象:100%(7/7),完成。
写入对象:100%(8/8),695字节,完成。
合计8(delta 6),重用0(delta 0)
致命:松散对象455f30c5243ec5b5cc698b1e51bdfb23ee6c1b22(保存在./objects/45/5f30c5243ec5b5cc698b1e51bdfb23ee6c1b22中)已损坏
错误:解包失败:解包 - 对象异常退出
至git@dev.my-host.org:my-repo.git
! [remote rejected] master - > master(n / a(unpacker error))
错误:未能将一些文件推送到'git@my-host.org:my-repo.git'

有什么想法吗?

编辑#1

gitolite日志显示如下:

  2012-10-22.10:59:59 13121 ssh ARGV = drgomesp SOC = git-receive-pack'my-repo.git'FROM = 187.65.248.7 
2012-10-22.11:00:00 13121 access(my-repo,drgomesp,W,'any'), - > refs /.*
2012-10-22.11:00:00 13121 trigger,Writable,access_1,ACCESS_1,my-repo,drgomesp,W,any,refs /.*
2012-10-22.11: 00:00 13121 pre_git my-repo drgomesp W any - > refs /.*
2012-10-22.11:00:00 13121 system,git,shell,-c,git-receive-pack'/home/git/repositories/my-repo.git'
2012-10-22.11:00:00 13121 END


解决方案

我设法让它正常工作,将原始的回购指向Redmine,因为两者都坐在同一台机器上,方法如下:

使用gitolite存储库的原始仓库在Redmine上添加仓库。路径可能类似于 /home/git/repositories/my-repo.git 。最初,Redmine没有任何读取存储库的权限,因此我们通过添加Redmine用户(通常通过运行 apache )到 git > usermod -a -G git www-data (注意你的服务器的配置,因为根据配置gitolite的方式,这可能有点不同。) $ b
  • .gitolite.rc 文件中的 UMASK 属性从默认值 0077 0022 ,相当于 755(rwxr-xr-x) code>用于目录, 644(rw-r - r - )用于文件。

  • 对于现有的回购协议,您可能需要运行 chmod -R g + rX


    如果您仍然遇到Redmine的权限问题,它会打开一个 404 而不是repository选项卡上的repo,您​​可能必须在t上运行 chmod -R g + rX 他整个 / home / git / repositories ,以确保Redmine用户可以通过repos阅读。


    I have a Redmine installation on the same server as my gitolite repositories.

    In order to link my repository to my Redmine instance, I locally cloned the repo with the following command:

    git clone --bare --local /home/git/repositories/my-repo.git
    

    Just as I successfully clone the repo on the server, I can navigate through the repo on Redmine, as expected.

    The thing is, as soon as I do that, I can't push anything more to the remote repo on my local machine.

    When I try

    git push
    

    I get the following errors:

    Counting objects: 15, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (7/7), done.
    Writing objects: 100% (8/8), 695 bytes, done.
    Total 8 (delta 6), reused 0 (delta 0)
    fatal: loose object 455f30c5243ec5b5cc698b1e51bdfb23ee6c1b22 (stored in     ./objects/45/5f30c5243ec5b5cc698b1e51bdfb23ee6c1b22) is corrupt
    error: unpack failed: unpack-objects abnormal exit
    To git@dev.my-host.org:my-repo.git
     ! [remote rejected] master -> master (n/a (unpacker error))
    error: failed to push some refs to 'git@my-host.org:my-repo.git'
    

    Any ideas on that?

    EDIT #1

    The gitolite logs show the following:

    2012-10-22.10:59:59     13121   ssh     ARGV=drgomesp   SOC=git-receive-pack 'my-repo.git'   FROM=187.65.248.7
    2012-10-22.11:00:00     13121           access(my-repo, drgomesp, W, 'any'),-> refs/.*
    2012-10-22.11:00:00     13121           trigger,Writable,access_1,ACCESS_1,my-repo,drgomesp,W,any,refs/.*
    2012-10-22.11:00:00     13121   pre_git my-repo      drgomesp        W       any     -> refs/.*
    2012-10-22.11:00:00     13121           system,git,shell,-c,git-receive-pack '/home/git/repositories/my-repo.git'
    2012-10-22.11:00:00     13121   END
    

    解决方案

    I managed to get it working pointing the original repo to Redmine, since both sit on the same machine, by following some simple steps:

    1. Add a repository on Redmine with the original repo of gitolite's repository. The path would be something like /home/git/repositories/my-repo.git.

    2. Initially, Redmine doesn't have any permissions to read the repository, so we fix the problem by adding the Redmine user (usually www-data or apache) to the git group by running usermod -a -G git www-data (be aware of your server's configuration, because that can be a little different, according to how you configurated gitolite.

    3. Change the UMASK property on the .gitolite.rc file, from the default value of 0077 to 0022, the equivalent of 755 (rwxr-xr-x) for directories and 644 (rw-r--r--) for files.

    4. For existing repos, you might need to run a chmod -R g+rX

    If you still experience the permissions trouble with Redmine, where it opens a 404instead of the repo on the repository tab, you might have to run a chmod -R g+rX on the whole /home/git/repositories, in order to make sure the Redmine user can read all the way through the repos.

    这篇关于Redmine + Gitolite - 存储库权限等问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆