Skip to content

Instantly share code, notes, and snippets.

@Fedalto
Fedalto / pre-receive
Created March 27, 2013 20:25
Git hook to make a git repository master branch read only. This should go in .git/hooks/
#!/usr/bin/env ruby
old_sha1, new_sha1, ref = gets.split
if ref == "refs/heads/master":
puts "Pushing to origin/master is not permitted."
puts "This is a read-only branch."
puts ""
puts "Create a new branch instead, or commit to SVN."