Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8879977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:04:23+00:00 2026-06-14T20:04:23+00:00

I can’t seem to get any git hooks working on my setup. sjakubowski@sjakubowski:~/Work/git$ mkdir

  • 0

I can’t seem to get any git hooks working on my setup.

sjakubowski@sjakubowski:~/Work/git$ mkdir hookstest
sjakubowski@sjakubowski:~/Work/git$ cd hookstest/
hookstest$ git init

Initialized empty Git repository in /home/sjakubowski/Work/git/hookstest/.git/

hookstest$ git commit -m "initial commit"

[master (root-commit) 82b95e0] initial commit
 0 files changed
 create mode 100644 testfile

hookstest$ touch .git/hooks/commit-msg
hookstest$ nano .git/hooks/commit-msg
hookstest$ cat .git/hooks/commit-msg

#!/usr/bin/env ruby
message_file = ARGV[0]
message = File.read(message_file)

#starts with # then number, space, and at least 5 words no more than 200
$regex = /(^#[0-9]+ \W*(\w+(\W+|$)){5,200})/

if !$regex.match(message)
puts "Your message is not formatted correctly (example: #XXX at least 5 words)"
exit 1
end

hookstest$ touch testfile2
hookstest$ git add testfile2
hookstest$ git commit -m "this message won't be blocked"
[master adea486] this message won't be blocked
 0 files changed
 create mode 100644 testfile2

What am I missing? Here is my configuration.

hookstest$ git --version
git version 1.7.9.5
hookstest$ ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
hookstest$ git config --list
user.name=Sylvester Jakubowski
user.email=XXXX@gmail.com
github.user=sjakubowski
github.token=XXXX
color.ui=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:04:24+00:00Added an answer on June 14, 2026 at 8:04 pm

    The hook files must have set the executable bit (chmod +x), otherwise they can’t be executed by Git.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can't seem to get this to work. The idea is to calculate the percentage
Can any one tell, how to get the result of LINQ query contains group
Can i get the source code for a WAMP stack installer somewhere? Any help
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can someone maybe tell me why this is not working? I have used echo
Can some one confirm me that only one UIWindow instance is possible in any
Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object
Can't seem to figure out what's wrong with the simple getJSON call below. It's
Can any one tell me clearly why ? Reading is simple in ArrayList,( we
Can any one help me in sorting this out in sed/awk/perl Input file Start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.