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

Why is exit my status valid in command line but not within bash script? (Bash)

There are a few layers here, so bear with me. My docker-container ssh -c"echo 'YAY!'; exit 25;" command executes echo 'YAY!'; exit 25; in my docker container. It returns: YAY error: message=YAY! , code=25 I need to know if the command within the…
tylersDisplayName
  • 1,603
  • 4
  • 24
  • 42
0
votes
1 answer

Git pre-commit hook behavior with Intellij Idea

I have a monorepo project with pre-commit git hook that bumps version in package.json files. This hook uses the following script: #!/usr/bin/env bash set -e # See if git detects any changes for the given directory if [[ -z `git diff --cached…
0
votes
1 answer

Tslint on latest Ionic

I am trying to lint my ionic project and abort the commit if lint fails. Running npm run lint in the console shows the error. I have installed precommit and lately husky ("husky": "^0.15.0-rc.6") with the below code inside package.json "husky": { …
Xerri
  • 4,916
  • 6
  • 45
  • 54
0
votes
1 answer

git flow (avh edition) hooks are not executed

I had the problem, that hooks that reside in my global hook directory ~/git-hooks are not executed. Namely the git-flow dependent hook post-flow-release-start just wasn't called, while the hook pre-commit was called without any problems.
atripes
  • 1,683
  • 4
  • 20
  • 23
0
votes
2 answers

How to count non-ASCII characters with Git commit-msg hook on Windows?

I work with Git on Windows via TortoiseGit and currently I'm trying to use this commit-msg hook to check length of commit messages' lines. All is fine when i write messages exclusively with ASCII characters. But when I write a message in Russian, a…
Igor Melnichenko
  • 134
  • 2
  • 13
0
votes
0 answers

post-receive hook not responding to the push from my local machine

I have the following script as a post-receive git hook on the server. It is meant to automate the deployment whenever a git push is made. #!/bin/bash DEPLOYMENT_BRANCH=dev WORKING_DIR=/300gb/project while read oldrev newrev refname do # there…
Suhail Gupta
  • 22,386
  • 64
  • 200
  • 328
0
votes
0 answers

Git: how does git push handle an encrypted folder when "push"

Scenario: using git to push to a remote repo. Local and remote are regular git repos, not encrypted. Putting a possible ecryptfs filesystem within a folder within the repo to be pushed. If: a git pre-hook would assure unmounting the folder(umount…
m___
  • 101
  • 1
0
votes
1 answer

How can i select the comitted files in a post-receive hook in git?

I need to get the file names, which are comitted withhin the post-receive hook. #!/bin/bash while read oldrev newrev refname do /* If updated-file == "myFile", then do a specific task */ done How can i get a reference to the changed files?
Emre Öztürk
  • 2,660
  • 4
  • 16
  • 19
0
votes
0 answers

In a Hook, pull a diff for the first commit in a pushed branch against the SHA it was created against

I have on the surface what appears to be a simple issue to handle but under the covers things get sticky quick. I am still at the straw man stage so there isn't any functional code to share. The Desired Behavior: We attach diffs for commits to our…
JonE
  • 1
0
votes
1 answer

Configuring git-flow hook for pre-release using SourceTree?

Is there a way that I can configure hooks to run a set of commands before a release is committed to a version when using Git Flow in SourceTree? I want to be able to make sure that when the last commit before a release is committed that npm run prod…
OpensaurusRex
  • 842
  • 1
  • 12
  • 30
0
votes
1 answer

Github: Any ideas on how to have merging dependencies between commits/repos?

Consider two repos, webui_repo and webservice_repo, that are two interdependent systems (the web UI and service, respectively). As you can imagine, the webui depends on webservice, but imagine that they've grown a lot and are managed by two teams,…
Alvaro Cavalcanti
  • 2,938
  • 4
  • 21
  • 31
0
votes
2 answers

Implement Git hook - prePush and preCommit

Could you please show me how to implement git hook? Before committing, the hook should run a python script. Something like this: cd c:\my_framework & run_tests.py --project Proxy-Tests\Aeries \ --client Aeries --suite
Lakshmi narayana
  • 184
  • 1
  • 3
  • 10
0
votes
2 answers

Git pre-commit running after commit?

I'm trying to run a format command on code before it's committed. I ether want it to not allow commit if unformatted or automatically do it before committing. What happens now is the commit happens and the formatting is applied after the commit as…
Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
0
votes
1 answer

Git hook fails ONLY on commit

Executive summary I have a project with a custom pre-commit hook, with a tree that looks something like this: parent | - .git - hooks - pre-commit | - smoketests - argument_tests.sh | - bitshuffle.py When I run .git/hooks/pre-commit, it runs…
jyn
  • 463
  • 4
  • 16
0
votes
1 answer

Wrong date come in pre-receive hook

I trying to find the working branch name by using git command. Of course, I can able to get the proper branch name in my local (windows) machine. If I use the same command in pre-receive hook file means it prints only master. But in local I get the…
Arunkumar
  • 73
  • 1
  • 11
1 2 3
99
100