Skip to content

Instantly share code, notes, and snippets.

@Fedalto
Created March 27, 2013 20:25
Show Gist options
  • Save Fedalto/5257702 to your computer and use it in GitHub Desktop.
Save Fedalto/5257702 to your computer and use it in GitHub Desktop.
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."
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment