1

I am using the Gitolite to create the git repo.

I have requirement that when user push something to repo it must have some specific file (eg. .md file) otherwise don't let push the code.

So now I need to configure a post-push hook and do some operation on pushed content.

Can any one please help me to do the same?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user9873999
  • 311
  • 3
  • 15

1 Answers1

0

First, I would not recommend gitosis (old and obsolete).

Second, this is a job for a VREF (update hooks in Gitolite lingo).
You can use in that VREF a diff --name-only or diff --name-status:

 git diff --name-only <sha-old> <sha-new>

(See shell explained)

If the list doesn't include your .md file, you would exit with a non-zero status, and the git push would be denied.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250