FAQ Database Discussion Community


Git post-receive hook is not executed

linux,git,githooks,git-post-receive
The following post-receive hook: #!/bin/bash echo "-> Post-receive test" is not executed when pushing to my remote repository. The remote is ssh://[email protected]:2222/home/git/repo.git (it's a VM) and works, as when I manually checkout it I see the modifications I've made. Some additional informations ... $ ls -al /home/git drwxr-xr-x 7 git...

post-receive hook generating 'no such file or directory' error

git,git-post-receive
I am attempting to set up a post-receive hook for a production website. The code seems to partially work, but the files are not copied. In this directory I have set up a bare repository: public_html/deploy-dir In hooks/post-receive there is the following code: #!/usr/bin/env ruby # post-receive # 1. Read...

“git push” deletes untracked remote files

git,openshift,git-post-receive
I am running a web server that allows users to upload images to the server. However, I am using git to manage my source code, and the git push operation deletes anything on the server which doesn't match my local checkout - so I lose the images every time I...

git diff not working on a bare repo, post-receive hook

git,gitlab,githooks,git-post-receive
I am working on a post-receive hook on a bare repo. I want to get the file names that are changed and pushed in this bare repo (only the latest one). To get it i am using this command. git diff --name-only HEAD^ This gives me error when I push...

How do I get my files uploaded with post-receive?

git,git-post-receive
I have the following shell script as post-receive hook, which should copy my working copy into my /mnt/repo/ folder: #!/bin/sh rm -rf /tmp/repo/ rm -rf /mnt/repo/* mkdir /tmp/repo/ && cd /tmp/repo/ git init git remote add origin file:///home/git/repos/repo.git git fetch git checkout development cp -r /tmp/repo/* /mnt/repo/ If I run...

Why are Git post-receive hooks typically in bare repos?

git,githooks,git-post-receive
Most mentions of post-receive hooks that I have seen are set up in bare repos. Why is this? If I only want pushes to the master branch to get deployed to my public_html folder, and all of my pushes are going to a bare repo with a post-receive hook, doesn't...