Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a git clone for viewing only

We're using git as our VCS for a small development team. I keep the main repository on our server as a bare git repository.

Management and people not involved with the project need to be able to see the code and documentation without knowing anything about git, so I also keep a clone on our server for browsing. To keep the clone up-to-date, I have installed a hook that updates the master branch of the clone whenever someone commits to the bare repository.

Here's the problem: some knucklehead always goes into the browsing clone and starts modifying code, which causes the master branch push operation to fail. I would like to figure out a way to either enforce a read-only policy on this one clone or figure out another way to keep it up-to-date.

like image 385
mjohnson Avatar asked Sep 19 '25 15:09

mjohnson


1 Answers

The best way to deal with these situations is having a good talk with the knucklehead in question.

Otherwise the easiest is to simply use the permission system of the operating system so the files are readonly for everyone except the script which updates it from the bare repository.

You can also get reset --hard and git clean -f before pulling from the bare repo.

(Oops, sorry, did the script wipe out 2 weeks of work???? )

like image 56
Peter Tillemans Avatar answered Sep 21 '25 14:09

Peter Tillemans