Description: Ubuntu 22.04.1 LTS
Release: 22.04
Run Code Online (Sandbox Code Playgroud)
我试图在用户下执行一些 git 命令www-data,但它不起作用。
为了排除故障,我尝试运行sudo -u www-data git show但它返回fatal: detected dubious ownership in repository
如果我运行sudo -u www-data git diff --shortstat它会返回warning: Not a git repository. Use --no-index to compare two paths outside a working tree
我也尝试添加到sudoers
www-data ALL=(ALL) NOPASSWD: /usr/bin/git show
# and also
www-data ALL=(ALL) NOPASSWD: /usr/bin/git
Run Code Online (Sandbox Code Playgroud)
仍然遇到同样的错误。有什么想法吗?谢谢。