I am trying to run git from a different directory than I am in. So for example if I am in:
cd /home/domain/
git status << runs perfect ie
# On branch master
# Your branch is ahead of 'origin/master' by 6 commits.
So now I want to run this command from a different directory using the --git-dir
option.
So lets say I'm in root/
and try this:
git --git-dir="/home/domain/" status
## Error
fatal: Not a git repository: '/home/domain/'
I've also tried to include the .git
folder i.e.
git --git-dir="/home/domain/.git/" status
But this looks like it's trying to run git from the root, i.e. deleting everything from my domain folder and adding everything in root.
Hope someone can advise on what I'm doing wrong.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…