我試圖從與我所在的目錄不同的目錄中運行git。例如,如果我位于:cd /home/domain/git status << runs perfect ie# On branch master# Your branch is ahead of 'origin/master' by 6 commits.因此,現在我想使用該--git-dir選項從其他目錄運行此命令。因此,可以說我正在root/嘗試以下方法:git --git-dir="/home/domain/" status## Error fatal: Not a git repository: '/home/domain/'我也試圖包括.git文件夾,即git --git-dir="/home/domain/.git/" status但這似乎是試圖從根目錄運行git,即從我的域文件夾中刪除所有內容并在root中添加所有內容。希望有人可以建議我做錯了什么。
3 回答

FFIVE
TA貢獻1797條經驗 獲得超6個贊
您還必須定義工作目錄。我知道令人困惑,但這是靈活的事情。
git --git-dir=/mycode/.git --work-tree=/mycode status
- 3 回答
- 0 關注
- 765 瀏覽
添加回答
舉報
0/150
提交
取消