1

I tried to do git stash on my production server using 'deploy' user, but it gives error as

/usr/lib/git-core/git-stash: 440: cannot create /app/app_name/.git/logs/refs/stash: Permission denied

The error doesn't show up for 'root' user.

what could be the reason for error and how to resolve it ?

4

1 回答 1

0

这取决于你如何创建你的仓库。
尝试使用创建的存储库git init --shared,以便同一组的多个用户能够访问和写入您的存储库。

--shared[=(false|true|umask|group|all|world|everybody|0xxx)]

指定 Git 存储库将在多个用户之间共享。
这允许属于同一组的用户推送到该存储库。指定后,设置配置变量“ core.sharedRepository”,以便$GIT_DIR使用请求的权限创建下的文件和目录。
如果未指定,Git 将使用 umask(2) 报告的权限。

您可以在“在许多帐户中使用不带 Sudo 的 Git ”中找到更多信息。

对于您当前的 repo,请确保deploy有权访问/app/app_name/.git.

OP rtcoms确认

3 个文件归root用户所有。它确实奏效了。

于 2013-05-15T06:09:15.123 回答