Issue on Gitolite permissions on a derived branch from a restricted one

36 views Asked by At

I have two branches dev and ui, and I'm trying to merge ui into dev on a temporary branch dev-ui. I've created a new branch from dev, and merged ui into it. So my branch schema is:

dev ----- dev-ui
ui  --/

I'm using Gitolite, and I've locked master and dev branches from unauthorized writes. This is my config related file:

@myRepoDevs = dev1 dev2

repo    myRepo
  RW+                            = admin
  R     dev master               = @myRepoDevs
  -     dev master               = @myRepoDevs
  RW                             = @myRepoDevs

When one of two devs tries to push on dev-ui to origin, he receives this error from git console:

remote: FATAL: W refs/heads/dev-ui myRepo dev1 DENIED by refs/heads/dev
remote: error: hook declined to update refs/heads/dev-ui
To myServer:myRepo
 ! [remote rejected] dev-ui -> dev-ui (hook declined)
error: failed to push some refs to 'myServer:myRepo'

Why he can't push on dev-ui?
Is because it is directly derived from dev, or is because it has the prefix dev on its name? Or an other reason?

1

There are 1 answers

0
VonC On BEST ANSWER

Gitolite uses refex:

A refex is a word I made up to mean "a regex that matches a ref".

A refex is implicitly anchored at the start, but not at the end. In regular expression lingo, a ^ is assumed at the start (but no $ at the end is assumed).
So a refex of master will match all these refs:

refs/heads/master
refs/heads/master1
refs/heads/master2
refs/heads/master/full

Son in your case, you need dev$ in your gitolite rules.