Question

I have a windows machine setup with a something like this:

N:\path\to\dir\project1.git
N:\path\to\dir\running_dir

where N: is a mapped network drive.

I'm trying to automatically checkout project1.git in my running_dir upon pushing to project1.git. I have followed this post on exporting GIT_WORK_TREE; however, I am confused on what path to use in my post-receive hook:

#!/bin/sh
GIT_WORK_TREE= ????????
export GIT_WORK_TREE
git checkout -f

Suppose that N: maps to C:\a\b on the remote windows machine.

Currently trying: /c/a/b/path/to/dir/running_dir

edit: Also trying:

git --work-tree=/c/a/b/path/to/dir/running_dir checkout -f

and getting: fatal: this operation must be run in a work tree

Was it helpful?

Solution

Adding absolute paths weren't working - regardless what I tried. Easily fixed by supplying a relative path to --work-tree though

OTHER TIPS

Run bash-shell in N:\path\to\dir\running_dir, in which perform pwd.

Output of this command will be path, translated for bash

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top