是否可以为特定分支指定文件规则?

时间:2013-11-15 13:02:13

标签: gitolite

我有一个GIT存储库foo,包含2个分支:branch1branch2。我想设置一个gitolite规则,拒绝仅为this用户的branch1推送bar文件的修改。这是我到目前为止所尝试的:

repo foo
    - branch1/this = bar

repo foo
    - branch1/NAME/this = bar

repo foo
    - branch1 /NAME/this = bar

我甚至不知道这是否可能与gitolite。

非常欢迎任何帮助。提前谢谢。


编辑:我尝试了这2个配置as suggested。以下内容:

-  branch1 VREF/NAME/this = bar
RW branch2 VREF/NAME/this = @all

拒绝两个分支

remote: FATAL: W VREF/NAME/this testing bar DENIED by VREF/NAME/this
remote: error: hook declined to update refs/heads/branch2
remote: FATAL: W VREF/NAME/this testing bar DENIED by VREF/NAME/this
remote: error: hook declined to update refs/heads/branch1
To debian:testing.git
 ! [remote rejected] branch2 -> branch2 (hook declined)
 ! [remote rejected] branch1 -> branch1 (hook declined)
error: failed to push some refs to 'debian:testing.git'

以下

RW branch2 VREF/NAME/this = @all
-  branch1 VREF/NAME/this = bar

允许推送两个分支

To debian:testing.git
   f6bc01d..09b63ab  branch2 -> branch2
   7a868cf..09bcb63  branch1 -> branch1

使用相同的分支(branch1

RW branch1 VREF/NAME/this = @all
-  branch1 VREF/NAME/this = bar

To debian:testing.git
   9c50fc4..02f350d  branch1 -> branch1

-  branch1 VREF/NAME/this = bar
RW branch1 VREF/NAME/this = @all

remote: FATAL: W VREF/NAME/this testing bar DENIED by VREF/NAME/this
remote: error: hook declined to update refs/heads/branch1
To debian:testing.git
 ! [remote rejected] branch1 -> branch1 (hook declined)

1 个答案:

答案 0 :(得分:1)

应该是:

repo foo
    - branch1 VREF/NAME/this = bar

我对" VREF-based"使用了类似的gitolite disallow access for directory on master branch but not on user branch规则 ' VREF/...'是重要的部分(' NAME'单独工作,' VREF/NAME' will)

相关问题