Git推送错误:无法解除旧链接(Permission denied) [英] Git push error: Unable to unlink old (Permission denied)
问题描述
在远程服务器上,我设置了一个post-receive钩子,以便对我的仓库进行git签出:
#!/ bin / sh
GIT_WORK_TREE = / var / www /< website> git checkout -f
但是当我从本地机器推送到服务器中的git存储库时,我收到以下错误消息:
remote:错误:无法取消旧链接'< file>'(Permission denied)
这会出现很多次,几乎每个文件都有一个错误信息。
然而,我有一个README.txt文件,我可以使用git进行更改,下面是它的权限:
-rw-r - r-- 1< serverusername> < serverusername> 2939 Aug 2 10:58 README.txt
但其他具有完全相同所有者和相同权限的文件,给我那个错误。
在另一个网站的另一个本地存储库中,我有我的本地计算机用户名作为所有者的文件,当我推送到远程服务器时,它尊重远程服务器所有者的文件和工作就像一个魅力。
显然这似乎是一个权限相关的错误,但我找不到解决方法,任何建议?
当您必须取消链接文件时,您必须拥有文件所在目录的权限'w',而不是为文件...
In the remote server I have a post-receive hook set up in order to make a git checkout of my repository:
#!/bin/sh
GIT_WORK_TREE=/var/www/<website> git checkout -f
But when I make a push from my local machine to the git repository in the server, I get the following error messages:
remote: error: unable to unlink old '<file>' (Permission denied)
This appears many times over, one error message for almost every file.
However I have a README.txt file that I'm able to change using git, here are its permissions:
-rw-r--r-- 1 <serverusername> <serverusername> 2939 Aug 2 10:58 README.txt
But other files with exactly the same owner and same permissions, give me that error.
In another local repository for another website, I have the files with my local machine username as owner, and when I push to the remote server it respects the remote server owner of the files and works like a charm.
Obviously it seems a permissions related error, but I can't find a way to fix it, any suggestions?
When you have to unlink file, you have to have permission 'w' for directory, in which file is, not for the file...
这篇关于Git推送错误:无法解除旧链接(Permission denied)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!