It is now possible to restrict read access to gitolite branches with the latest version of gitolite v3.x using the partial-copy feature of gitolite
- Be sure to use the latest gitolite version
- uncomment the
partial-copy
line in the ENABLE
section of the ~/.gitolite.rc file
- set
$GIT_CONFIG_KEYS = '.*'
in the ~/.gitolite.rc file
- Use the partial-copy option to have another repository which is a copy of your original repository but without some branches.
Example: if you want the client to only have access to the deploy
branch
repo my-repo
RW+ = @coworkers
repo my-repo-deploy
RW deploy = @clients
- = @clients
- VREF/partial-copy = @all
config gitolite.partialCopyOf = my-repo
if git complain that it cannot delete the master branch you can use this command on the server:
sudo git config --system receive.denyDeleteCurrent warn
sudo git config --global receive.denyDeleteCurrent warn
The clients can now clone the deploy branch of the my-repo-deploy repository with a command like this:
git clone -b deploy git@your-server:my-repo-deploy