Questions tagged [githooks]

Git hooks are scripts that are executed upon certain Git events. Events include, but are not limited to, pre- and post-commit and pre- and post-rebase on the client-side, and post-receive-commit on the server-side. No need to use the tag Hooks when using the tag Githooks. Maybe used in combination with tag Webhooks

What is it?

Git hooks are scripts that are executed upon certain Git events. Events include, but are not limited to, pre- and post-commit and pre- and post-rebase on the client-side, and post-receive-commit on the server-side. Hooks can be written in most any scriptable language, including Ruby, Perl, Bash, and shell.

Related tags

  • Git hooks are prohibited on most commercial Git services like GitHub, Bitbucket or GitLab, for security reason. Those propose which are only able to send a JSON payload to a URL (like a push).
  • Use for other hooking mechanisms in the source management or build process that do not rely on Git hooks.
  • Use for webhooks used on GitHub as an alternative to Git hooks.

Useful Links

1768 questions
0
votes
1 answer

How to detect changing files in selected folder and selected file extension?

How to config git hook for detecting exactly selected folder (exem /../../schemas) and exactly selected file extension (exem *.xsd)?
Slava Podolskiy
  • 155
  • 1
  • 11
0
votes
1 answer

Git hook/post-receive No such file or directory

So I've got a bare repository which we use to control the changes to our web pages. On that bare repo is a post-receive hook that runs when we push our changes to it. All the hook does is implement the changes to the working directory using the…
0
votes
1 answer

something wrong with my pre-commit file

This is my pre-commit file (placed in .git/hooks) from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import argparse import io import sys def replace_strings(filename): f =…
Areso
  • 67
  • 1
  • 2
  • 11
0
votes
0 answers

Bypass git hook in package.json

I have git hooks defined in package.json for pre-commit and I just added one for pre-rebase. The problem is that I do not want the pre-rebase hook to execute on a git pull which happens right now due to the flow. I tried searching how I could…
phantomsays
  • 187
  • 2
  • 11
0
votes
1 answer

Is there a maven-git-checkstyle plugin that runs checkstyle goal on git staged files alone?

We are working on a legacy app code base and doing incremental development to improve its code quality. When we ran the maven checkstyle goal on the project we got tons of errors. To address the issues incrementally, we are taking an approach to run…
0
votes
1 answer

How can I apply githook in subdirectories?

As far as I can see, git hook files can only be put into the root/hooks directory. But currently, we don't have the permission of that directory. Our project just lies in one of the subdirectories. We just want to run some test cases before we run…
Aaron
  • 461
  • 6
  • 17
0
votes
1 answer

Python Wheel (pip install) with Git hooks

I'm trying to move some git hooks into place as part of a pip install target command, but pip seems to refuse and if I use upgrade, it blows away the git folder. I think this Github issue is the problem, but just trying to confirm.
martin
  • 119
  • 6
0
votes
1 answer

Gitlab with repositories on a cifs mount fails to create new project

We have a gitlab server running on our internal network which is configured to store repositories on a cifs mount (project requirement). Moreover this nas drive must be accessible from the outside network and should also allow git operations on…
schwarz
  • 501
  • 7
  • 28
0
votes
1 answer

git post-receive hook, windows (server and client) want to call python

I'm using Bonobo (a windows git server), I'm new to it, and trying to on commit to origin it fire off a Python script which would be able to: find the user that did the last commit find the commit message send that information to Python Once it…
sniperd
  • 5,124
  • 6
  • 28
  • 44
0
votes
2 answers

execute git hooks in non executable environment/ edit how git calls hooks

Question: how do you edit how git calls a hook? TL;DR - my hosting platform's security is weird and I need to figure out how to edit how git calls the post-receive hook. I'm trying to setup automatic deployment via GIT, but the main way people…
Philip Aarseth
  • 301
  • 4
  • 16
0
votes
0 answers

Git hook when a merge fails

I've got a challenge regarding GIT. I'm trying add and checkout specific files when a merge fails. I already created a post-merge hook which checks if there are files with UU-flag (Both modified) but the post-merge hook isn't invoked when a merge…
0
votes
3 answers

gitlab : How to bypass ESLint errors while trying to commit

I was trying to commit the changes to my dev branch in Gitlab, but whenever i try to commit changes it shows the errors of ESLint and the commit gets aborted. I tried cloning the repository from dev branch and made changes and installed…
FortuneCookie
  • 1,756
  • 3
  • 25
  • 41
0
votes
1 answer

How can I allow merging to master only from testing branch?

I have a master branch and a testing branch. I push some stuff to testing and when everything is okay and tested, I merge testing branch to the master. Is there a way to create such a server hook which forbids pushing commits to master which are not…
VP.
  • 15,509
  • 17
  • 91
  • 161
0
votes
0 answers

vim error `.git/hooks/post-commit.sample/post-commit" E212: Can't open file for writing`

In the .git/hooks folder I need to make a post-commit.sample folder and add a post-commit file to it (and edit a line into it). There was no post-commit file or post-commit.sample folder so I used mkdir and touch to create the file. But when I…
picasso13
  • 11
  • 1
  • 5
0
votes
0 answers

Is there a way to prefill TAG_EDITMSG file

I need to prefill the message of the git tag that is about to be created created with some data. This way, once the editor is open, the user can check that data and do some changes if necessary. The problem is that there is no hook that, AFAIK, can…
smarber
  • 4,829
  • 7
  • 37
  • 78