git-post-receive

Multiple git post-receive hooks

大城市里の小女人 提交于 2019-12-10 10:49:57
问题 i'm using Gitlab. Gitlab is creating following link to distribute the same hooks through all repositories hooks -> /opt/gitlab/embedded/service/gitlab-shell/hooks Within this directory there's already a post-receive hook to process the commits properly within Gitlab which is written in ruby. I'd like to add an additional hook written in bash. Is this possible? Best regards 回答1: Gitlab supports project hooks in a $GIT_DIR/custom_hooks directory. This is supported for the pre-receive , post

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

拜拜、爱过 提交于 2019-12-09 01:05:29
问题 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 branch1 and then push branch1. The post-receive hook processes the commits correctly. I merge branch1 into branch2 and then push branch2. The post-receive hook processes all the merged commits a second time. How can I avoid this? Below is the beginning of

Git site deployment - checkout in post-receive hook not working

自古美人都是妖i 提交于 2019-12-08 11:45:09
问题 I've followed this tutorial 'Using Git to manage a web site', using Tower to commit and push my local repo to the remote server. Pushing succeeds with the following message: Pushing to ssh://user@mysite.com/~/git/tprevo.git stdin: is not a tty Counting objects: 40, done. Delta compression using up to 2 threads. Compressing objects: 100% (37/37), done. Writing objects: 100% (40/40), 171.95 KiB, done. Total 40 (delta 3), reused 0 (delta 0) To ssh://user@mysite.com/~/git/tprevo.git * [new branch

git logs not matching when setting --work-tree with push-to-deploy post-receive hook

纵饮孤独 提交于 2019-12-08 08:32:20
问题 I have setup push-to-deploy with my production server by setting up a --bare directory at /home/ubuntu/push-to-deploy/test.git , using that as my remote and adding a hooks/post-receive inside the --bare looking like this: #!/bin/bash while read oldrev newrev ref do branch=`echo $ref | cut -d/ -f3` if [ "production" == "$branch" -o "master" == "$branch" ]; then git --work-tree=/var/www/test/ checkout -f $branch sudo chown -R ubuntu:www-data /var/www/test echo 'Changes pushed to Amazon EC2 PROD

How can I make Gitolite post-receive hook to show full path to modified file?

断了今生、忘了曾经 提交于 2019-12-08 05:19:00
问题 Here is my post-receive hook: #!/bin/bash while read oldrev newrev ref; do git diff --name-only oldrev..newrev git --work-tree=/tmp checkout HEAD -- plugin.yml echo -e "Test complete maybe..." | tee >(exec logger) done And here is the output: And if I replace oldrev..newrev by oldrev -- newrev, the output is: I need to get folder in which this file(plugin.yml) was modified. Thanks. 回答1: First, each hook can simply check its execution path: that will give you the name of the repo. Second, the

Git hooks, post-receive loop through commit

随声附和 提交于 2019-12-07 15:13:21
问题 Using git hooks on the server side, is it possible to loop through the new commit messages that were sent from the client to the server everytime someone pushes to the remote repository? I need to extract information from each message, hash,date,commit author,branch I cant find any good documentation on git hooks figure it out. I've read through git post-receive hook that grabs commit messages and posts back to URL and I don't understand a simple line of code 回答1: As is explained in the

git checkout bare with submodules in post-receive

怎甘沉沦 提交于 2019-12-07 07:47:59
问题 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 # http://blog.ekynoxe.com/2011/10/22/git-post-receive-for-multiple-remote-branches-and-work-trees/ # post-receive hook that checks out development branch after a push to the bare # repo # paths must exist livepath="/var/www/live" devpath="/var/www/dev" while read oldrev newrev ref do branch=`echo $ref | cut -d/ -f3` #if [[ "master" == "

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

痴心易碎 提交于 2019-12-07 05:07:51
问题 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 post-receive hook script to differentiate between pushes to my live site and pushes to my test site: while read ref do #echo "Ref updated:" #echo $ref -- would print something like example at top of file result=`echo $ref | gawk -F' ' '{ print $3 }'` if [

Git post-receive hook not working properly

空扰寡人 提交于 2019-12-06 16:29:19
I have a server with a git repository. Each time I make a push to that server I would like to regenerate my gitstats documentation for that repository. In that machine if I execute the following command, the gitstats documentation it's refreshed properly: gitstats /home/<username>/<proyect-name>/htdocs/ /home/<username>/gitstats And here it's my post-receive hook in the repository in that server: #!/bin/sh gitstats /home/<username>/<proyect-name>/htdocs/ /home/<username>/gitstats So when I make a push to that machine, it tries to execute that command, but it doesn't work correctly, the output

Deploy website using Git/Gitolite [post-receive hook doesn't work properly]

谁都会走 提交于 2019-12-06 09:44:58
问题 I'm trying to deploy my website using git/gitolite. I've created a remote repository, I cloned it to my local machine. I've 2 branches Master and develop. I've created a script of post-receive hook in order to deploy each branch in the correct web directory : /var/www/<mysite>/ for branch Master [live version] /var/www/<mysite>/dev for branch develop [dev version] for that I'm using this script in .gitolite/hooks/common/post-receive file : #!/bin/bash prodroot="/var/www/<mysite>" devroot="