I'm trying to implement a work-flow using git. Here's what I did:
- I have a project on my local (git initialized off course)
- I have added a remote pointing to
xyz
- I created a directory
xyz
on the server - Initialized git in
xyz
Executed
git config receive.denyCurrentBranch='ignore'
withingxyz
-Afterwards, I createdpost-receive
file in.gt/hooks
and added the following lines:#!/bin/bash GIT_WORK_TREE=/path/to/xyz LOGFILE=./post-receive.log cd /path/to/xyz/ echo "Checking out $PWD" echo "Run: checkout dev" git checkout dev echo "Run: git clean -df & git checkout dev" git clean -df & git checkout dev echo "Run: git submodule update --init " echo "Checking out sumodules" git submodule update --init chmod 755 -R /path/to/xyz
When I push
using git push xyz-branch dev --force
, I get the following errors:
remote: Checking out /path/to/xyz
remote: Run: checkout dev
remote: fatal: Not a git repository: '.'
remote: Run: git clean -df & git checkout dev
remote: fatal: Not a git repository: '.'
remote: Run: git submodule update --init
remote: Checking out sumodules
remote: fatal: Not a git repository: '.'
remote: Setting access rights on files and folders
remote: Run: chmod 755 -R /path/to/xyz/
I don't know should I blame the docs or myself for mot understanding the cause of the error.
Update
I was doing many things wrong.Thanks to a twitter friend who pointed out this SO question and I solved my problem. I think it's OK if I explain it as an answer.