I have to configure read-only access for some remote branches of a controlled git repository.
The scenario is as follows:
For our development, we have an internal "development repository" (1) that mirrors an "external repository". This "development repository" gets periodic updates (git remote update
in a cron
job). Our development takes place in branches "dev_*" derived from the external repositories, but never direct on the external branch:
The workflow for adding functionality to master
:
- We create a branch
dev_master
withmaster
as parent. - John clones the repository
development
, checks outdev_master
, works on it, and pushes regularly back todevelopment
. - If the repository
external
getsmaster
updated, so ismaster
indevelopment
(due to the above mentioned cronjob), and someone can mergemaster
ondev_master
, so we keep in sync withexternal
.
We need to forbid John's pushes to the branch master
of development
, so his changes doesn't get lost after the periodic update from external
.
Again, schematic:
Notes
(1) I could find that some people call this development repository "staging repository" (for example, in How do I setup a staging repository in git?, where a very similar situation has been presented)