I have gerrit installed.
When a project is created through the gerrit web UI, the project is reflected in the $GERRIT_SITE/git
folder.
For instance if a project trial is created on gerrit, a trial.git
folder is created in $GERRIT_SITE/git
folder.
But when I try to run any git
commands in $GERRIT_SITE/git/trial.git
folder such as follows, I get the following error:
$ git status
fatal: This operation must be run in a work tree
I do not know how to go about this and would need some guidance.
答案 0 :(得分:1)
原因是您在磁盘上找到的是裸存储库,没有工作树(即特定分支的文件)。对于Git服务器来说这是完全正常的,一旦克隆了存储库,就会在.git/
目录中找到相同的内容。
EDIT
当您将repo的路径指定为GIT_DIR
环境变量的参数时,您可以使用这些裸存储库在服务器端工作:
GIT_DIR=/var/gerrit/review/git/trial.git/ git log --quiet --pretty=medium
这是特别的。使用Gerrit Hooks做某事,合并新更改等时很有帮助。