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
5
votes
3 answers

Git for Websites / post-receive / Separation of Test and Production Sites

I'm using Git to manage my website's source code and deployment, and currently have the test and live sites running on the same box. Following this resource http://toroid.org/ams/git-website-howto originally, I came up with the following…
Walt W
  • 3,261
  • 3
  • 30
  • 37
5
votes
5 answers

Skip processing of Git revisions in post-receive hook that have already been previously processed

I have a git post-receive hook that extracts all the revisions that were added during a "git push" and does some processing on each one (such as sending notification emails). This works great except when merging; e.g.: I make some commits on…
Matt White
  • 329
  • 3
  • 11
4
votes
2 answers

Why does `rm -rf` behave differently when used in a git post-receive hook as opposed to shell?

I'm using this example on publishing a website w/ git post receive hooks. The hook pretty much clones the bare repo into a temporary directory, and after generating the site, removes that temporary git clone. #!/bin/sh # clone a repo, generate site…
Derrick
  • 2,356
  • 5
  • 32
  • 43
4
votes
1 answer

yarn install fails on cloning github packages in git post-receive hook

I have created a post-receive hook to deploy changes to an app and install packages via Yarn. It looks like this: #!/bin/sh echo "Checking out changes..." git --work-tree=/home/me/apps/app --git-dir=/home/me/repos/repo.git checkout -f echo "Yarn…
4
votes
2 answers

Post-receive hook for gitosis

I'm running Gitosis and want my committed work to be staged in my html directory. I was trying to use this approach to set GIT_WORKING_TREE to my html directory, but I'm getting the error remote: fatal: This operation must be run in a work tree. I…
Nona Urbiz
  • 4,873
  • 16
  • 57
  • 84
4
votes
1 answer

git post-receive hook and multiple commits in one push

I'm trying to understand what happens in a git post-receive hook when multiple commits are pushed together. From the documentation and the examples I've seen, I would expect it to accept a list of references from STDIN, allowing me to take action on…
cecukemon
  • 137
  • 1
  • 9
4
votes
1 answer

Git post-receive [[ not found

I have a git hook (post-receive), that looks like this: #!/bin/sh cd /home/vservices while read OLDSHA NEWSHA REF ; do if [[ "$NEWSHA" == "0000000000000000000000000000000000000000" ]]; then git --git-dir=/home/vservices/.git…
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
4
votes
1 answer

GIT post-receive hook doesn't run

This has been asked a lot of times and I went through countless threads and Google pages, but none seem to be able to fix my issue. Perhaps I am not doing it the standard way, but it should still work. I have a remote server that has a git repo I…
Metal Wing
  • 1,065
  • 2
  • 17
  • 40
4
votes
1 answer

Can the "post-receive" hook in gitlab-shell still be used for a custom hook?

According to the content of the gitlab-shell post-receive hook, it's deprecated. #!/usr/bin/env ruby # This file was placed here by GitLab. # IT IS DEPRECATED NOW. # All GitLab logic handled by update hook But only for Gitlab specific logic or…
nietonfir
  • 4,797
  • 6
  • 31
  • 43
4
votes
1 answer

Using git to manage a production web site?

I have a web site with about 15,000 files on a production server. A remote developer is now doing the bulk of the work on the site, but I occasionally need to make some edits also. It is apparent that we need some version control, and so I am…
Derrick Miller
  • 1,860
  • 3
  • 21
  • 37
4
votes
1 answer

git checkout bare with submodules in post-receive

how may I checkout a bare repository on my server in a post-receive hook that includes submodules? I currently have this as a post-receive hook: #!/bin/bash #…
kmindi
  • 4,524
  • 4
  • 31
  • 47
4
votes
1 answer

post-receive script for windows (email notification)

I've created a bare (central) repository on a windows machine. My colleagues and myself are now using this repository. I want the git to send out an email notification whenever it's updated. I know that we need to write some script in post-receive…
Karthik Bose
  • 33,556
  • 3
  • 33
  • 43
4
votes
2 answers

Why is EC2 not pulling updates from bitbucket/github via post-receive hook?

Before moving to EC2, I would push commits to a bitbucket repo and have a post-receive hook pull them to the server: after a commit, the url http://mywebsite.com/update.php is called, where update.php is: That used to work…
edpeciulis
  • 145
  • 1
  • 3
  • 9
3
votes
1 answer

How to re-create the Github post-receive for a private server?

I'm using the excellent Sprint.ly to manage my project. I'm using git for source control and Sprint.ly has an excellent integration with github by taking its post-receive message and scanning for changes (see their documentation). I'm not using…
Steve Workman
  • 315
  • 2
  • 14
3
votes
2 answers

git post-receive hook and prevent tags pushing

In my GIT's post-receive hook I need to avoid execution of some code if a tag is pushed. I tried using the env variable $refname but it looks empty. Any idea? Thanks Randomize
Randomize
  • 8,651
  • 18
  • 78
  • 133
1 2
3
14 15