Questions tagged [git-post-receive]

User defined script that is run on a git server after a git push command was issued.

A script that runs on a server after a git push command has been issued.

See http://git-scm.com/book/en/Customizing-Git-Git-Hooks

219 questions
60
votes
6 answers

Git Post-Receive Hook for Website Staging

I'm trying to set up Git for staging my website so that I can git pull to get the current version to work on locally and then git push to push the changes to the remote server. I've got it set up so that it works the way I want it to, but after I…
Matt
  • 615
  • 1
  • 6
  • 7
42
votes
4 answers

How to test git hooks

Since "testing" is a common use for a Git hook, my question is hard to search for. I'm writing a fairly involved git post-receive hook and want to know what the best way to test it is. Currently my process is: make changes to post-receive in a…
Errol
  • 662
  • 1
  • 6
  • 13
18
votes
4 answers

Jenkins and GitHub webhook: HTTP 403

I have a GitHub repository which I would like to have notify Jenkins of new commits via a post-receive hook. I've installed the GitHub plugin into Jenkins and have allowed for Jenkins to manage it's own hook URLs. The project has the correct git…
troutwine
  • 3,721
  • 3
  • 28
  • 62
17
votes
5 answers

Not able to detect branch from Git post-receive hook

I've got a post receive hook setup on the remote repo that tries to determine the branch name of the incoming push as follows: $branch = `git rev-parse --abbrev-ref HEAD` What i'm finding, though, is that no matter what branch I push from my…
jsleeuw
  • 283
  • 5
  • 13
16
votes
3 answers

reset hard on git push

I have a post-receive hook script sitting on the remote repo I am pushing to that does a git reset --hard Something like this: $ git push opal Counting objects: 74, done. Delta compression using up to 2 threads. Compressing objects: 100% (45/45),…
David
  • 4,235
  • 12
  • 44
  • 52
14
votes
1 answer

the receiving end does not support push options

At first my server's git version was 2.7.4 and the error was accurate. Afterwards, however, I updated and have confirmed this with git version: Server $ git --version git version 2.13.0 Client $ git --version git version 2.11.0 (Apple…
Froast
  • 742
  • 8
  • 16
12
votes
2 answers

git post-receive not working correctly

I have the following problem. I have updated the 'post-receive' to cd into a certain directory and then pull the repo in to deploy it like so: #!/bin/bash cd /var/www/site git pull origin master However whenever I do 'git push origin master' on my…
andy
  • 2,369
  • 2
  • 31
  • 50
12
votes
2 answers

Git: post-receive email hook to show an html formatted color diff?

I've got a diff e-mail sending using Git's post-receive e-mail hook (thanks to this SO post) but the e-mail that it sends is just plain text. I'd like something a big more colorful and well formatted. Is there a script or something I can run using…
cmcculloh
  • 47,596
  • 40
  • 105
  • 130
12
votes
3 answers

Git post-receive hook not working

We're using git with a central repo (using Gitosis). I've created a post-receive hook to generate an email to the dev mailing list whenever changes are pushed to the central repo, and to generate documentation from the documentation folder in the…
Silas Snider
  • 1,460
  • 1
  • 14
  • 23
12
votes
1 answer

github service hook and basic authentication

I'm trying to figure out how to secure a webhook reciever for a github service hook. In the github manual pages, when you look in the section on what IP addresses github hooks will come from, it has this warning: "We highly recommend that you don't…
Brian Tingle
  • 981
  • 11
  • 23
11
votes
2 answers

Are concurrent git pushes always safe if the second push only has fast-forwards from the first push?

I want to automatically push commits in the post-receive hook from a central repo on our LAN to another central repo in the cloud. The LAN repo is created using git clone --mirror git@cloud:/path/to/repo or equivalent commands. Because the files…
willkil
  • 1,619
  • 1
  • 21
  • 33
11
votes
2 answers

Make Github push to a remote server when it receives updates

What is the set up for having Github automatically push any updates to a remote server? This is useful for maintaining a codebase on Github, and having a website run off that codebase. I have my repo on my own computer, this is where I work. I…
Don P
  • 60,113
  • 114
  • 300
  • 432
10
votes
2 answers

catching a git post-receive error in a script

In a bash script I do a git push and I check its exit status. On the remote server there's a post-receive hook which does a few things. If an error occurs the post-receive hook will exit with a non-zero value. However when the post-receive hook…
Jistanidiot
  • 54,334
  • 4
  • 18
  • 29
9
votes
1 answer

Git Push to Rails Production Gives Response Your Ruby version is 1.9.3, but your Gemfile specified 2.2.2 When Ruby Version is 2.2.2

I have seen this error all over the place, but none of the solutions I have found have helped to fix the issue. I am developing a rails app locally on a Mac and have set up a droplet on DigitalOcean to push the app to. My droplet is running Ubuntu…
Carl
  • 1,246
  • 3
  • 21
  • 39
8
votes
3 answers

git post-receive hook can not jump back into original cwd

When pushing to our shared bare repository (over ssh), the post-commit does not work properly. It is pretty common as I found out in many threads here and it works fine for two other repositories on the same server, which drives me…
fab1An
  • 101
  • 1
  • 4
1
2 3
14 15