git-post-receive

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

旧巷老猫 提交于 2019-12-18 15:31:12
问题 This question was migrated from Server Fault because it can be answered on Stack Overflow. Migrated 8 years ago . 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 being committed will be large relative to our upstream bandwidth, it's entirely possible something like this could happen: Alice

Git post-receive hook to checkout each branch to different folders?

淺唱寂寞╮ 提交于 2019-12-18 03:41:49
问题 The basic setup of our Git workflow is a bare repository on a local network server with two developers pushing/pulling to it. We would like to automagically copy (checkout) each branch that gets pushed to a different location on our local network server. To exemplify: Pushing the 'develop' branch copies to 'develop' sub-folder. Pushing the 'master' branch copies to the 'master' sub-folder. The problem we are having is getting the post-receive hook to do this. Here is what we currently have: #

Git post-receive hook to checkout each branch to different folders?

怎甘沉沦 提交于 2019-12-18 03:41:29
问题 The basic setup of our Git workflow is a bare repository on a local network server with two developers pushing/pulling to it. We would like to automagically copy (checkout) each branch that gets pushed to a different location on our local network server. To exemplify: Pushing the 'develop' branch copies to 'develop' sub-folder. Pushing the 'master' branch copies to the 'master' sub-folder. The problem we are having is getting the post-receive hook to do this. Here is what we currently have: #

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

拥有回忆 提交于 2019-12-12 09:56:01
问题 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 install..." cd /home/me/apps/app yarn install Notes (stuff that is working): The first portion works fine. The hook is definitely running. The primary app files are updated as expected. When doing yarn install from the command line while ssh'd into

Using a post-receive hook to create a zip

独自空忆成欢 提交于 2019-12-12 09:48:52
问题 I've been playing around with hooks for a while now, but I can't seem to get the post-receive hook to work the way I need it to. I am trying to get the post-receive hook to create a zip folder and place it somewhere outside the git repository folders after I have pushed my changes to the repository. 回答1: You have a good example of deploying an zip through a post-receive hook in this article from Daniel Byrne: The idea is to use git archive --format=zip : #!/bin/bash # # A post commit hook

Git post-receive hook not working

拥有回忆 提交于 2019-12-12 08:22:59
问题 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 git repo. Therefore, in ~git/ I've got a directory, we'll call it 'a' that contains a clone of the git repo. The post-receive hook looks like: #!/bin/bash cd ~git/repositories/a.git . ~git/post-receive-email &> /dev/null ( cd ~git/a && git pull &>

GitHub WebHook POSTs not going through

爷,独闯天下 提交于 2019-12-11 19:45:56
问题 I've got github webhoooks set up to send a POST to a PHP script on my server when I push to a repo. (https://help.github.com/articles/post-receive-hooks) MY PHP script logs the connecting IP, as well as the payload received: $date = strftime('%c'); file_put_contents('log.txt', PHP_EOL.trim($date).PHP_EOL, FILE_APPEND); try { $payload = json_decode($_REQUEST['payload']); } catch(Exception $e) { exit(0); } //LOG THE POST REQUEST file_put_contents('log.txt', print_r($payload, TRUE), FILE_APPEND)

How to properly use post-receive hook?

允我心安 提交于 2019-12-11 07:12:47
问题 My directory structure is: ~/parent.git/.git/hooks/post-receive The post-receive hook looks like: #!/bin/sh git checkout -f When I push into parent.git, the script does not run. I can't figure out the problem, as every bit of the internet says this should work. I chmod'd post-receive, so I know that is not the problem. Any help is much appreciated. 回答1: As Chris mentioned you seem to have the same problem as reset hard on git push Specifically hooks run with CWD and GIT_DIR set to the .git

Git CHMOD post-receive hook

為{幸葍}努か 提交于 2019-12-11 06:20:55
问题 I'm using a bare remote repository on my webserver with a post-receive hook that will automatically push my files in the public_html directory. The problem is, I'm using codeigniter and the index.php file has to be chmod 755. I changed it on the server with filezilla, but after every push the index.php file gets set to 644, which results in an internal server error. This happens even when the index.php isn't changed or stashed.. I've searched for a solution, but so far without luck.. Could

How to discover a file is changed in GIT during a push

£可爱£侵袭症+ 提交于 2019-12-11 02:13:04
问题 when I push something to my GIT repository, the post-receive hook is triggered and executes some scripts. Is it possible doing something before the execution these scripts if (and only if) a specific file is changed respect to the previous push (for example .sql file)? Thanks Randomize 回答1: In the same post-receive hook as a first step or in a pre-receive or update hook, you can use git diff-tree --name-status -rz and pass in the new and old ref that are passed in to the hook ( either stdin