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.

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???? )


Why not simply provide access through gitweb, cgit or some other HTTP based repository browsing interface?

https://git.wiki.kernel.org/index.php/Gitweb


There is no way to make a git clone read-only. There are two workarounds that will achieve a similar effect.

One way is to change the permissions of the files and the folders, so that they are read-only.

The other way I can think of is using a permission system on the server. You can use gitolite to allow read-write or read-only access to specific users/groups using the repository. There is a list of other git management software here: https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#Access_control_.2F_Project_hosting


Need Your Help

Should git-apply or git-am come up with the same hash?

git sha1

I think I'm missing something. I was under the impression that git's usage of a SHA-1 hash commit identifier meant that one could be certain that patch obtained from someone else for that commit h...

E-mail Issue “Failure sending mail”

c# email razor

I am using Razor to send an E-mail through SMTP. I am using the same bit of code to do this in a different site, but I am getting an error on this one. I've changed the Web.config SMTP Settings. I'...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.