0

I initialized a remote ssh repo using git init --bare and added the following post-receive hooks

#!/bin/sh            

dest=/home/git/api
rm -rf $dest         
mkdir -p $dest       
GIT_WORK_TREE=$dest  
git checkout --force

The problem is i keep getting error

remote: fatal: This operation must be run in a work tree

I don't understand this error where am i going wrong ?

georoot
  • 3,557
  • 1
  • 30
  • 59

1 Answers1

2

There's no work tree in a bare repository. So, you'll have to clone the repo and add the hook.

vraj010
  • 116
  • 1
  • 2
  • 8