I want to work with Git repository, but working tree should be remote. For example: if I have my project stored inside of ~/project
and project.git
stored inside of ~/git/project.git
.
What I've changed working tree via config:
worktree=/Users/myuser/project
And I'm able to commit and view diff, but when I've tried to do git stash
, I got error:
fatal: /usr/libexec/git-core/git-stash cannot be used without a working tree.
How to store .git
directory far from working tree?
And why I'm getting this error?
git config --get core.worktree
returns correct working directory....
--git-dir
or set environment varGIT_DIR
, see accepted answer of stackoverflow.com/questions/5283262/…git init --git-dir
. How to use --git-dir? any documentation? Could it be set via config?