Git 远程:错误-“远程:错误:无法在 git push 后取消链接旧的‘filename_here’(权限被拒绝)”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11397030/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git remote: error- 'remote:error: unable to unlink old 'filename_here' (permission denied)' after git push
提问by badcrocodile
For about 2 weeks now whenever I did a git push I would get about 200 errors reading this- remote:error: unable to unlink old 'wp-plugins/foobar.php' (Permission denied). But I could still push files to the server- just not any files in the wp-plugins directory.
大约 2 周以来,每当我执行 git push 时,我都会收到大约 200 个错误——远程:错误:无法取消链接旧的“wp-plugins/foobar.php”(权限被拒绝)。但是我仍然可以将文件推送到服务器 - 只是 wp-plugins 目录中没有任何文件。
Today after doing some research into the permission denied error I ran this command: git reset --hard master (from https://github.com/mxcl/homebrew/issues/2906)
今天在对权限被拒绝错误进行了一些研究后,我运行了这个命令: git reset --hard master (来自https://github.com/mxcl/homebrew/issues/2906)
Now every file in my Wordpress directory gives me the remote:error: unable to unlink old 'directory/filename.php' (Permission denied) error (about 2000 of them)! The push seems to go through properly, but when I check the file I tried to push, the local file is changed, but the remote file is still unchanged.
现在我的 Wordpress 目录中的每个文件都给我远程:错误:无法取消链接旧的“目录/文件名.php”(权限被拒绝)错误(大约 2000 个)!推送似乎正常通过,但是当我检查尝试推送的文件时,本地文件已更改,但远程文件仍未更改。
If it is not painfully obvious by now, I am fairly new to Git. Please help. I have to use Git for my new job. As a freelancer I did not need version control, but now this is the only tool I have to update the website, and I can't, and I'm worried.
如果现在还不是很明显,我对 Git 还是相当陌生的。请帮忙。我的新工作必须使用 Git。作为一名自由职业者,我不需要版本控制,但现在这是我必须更新网站的唯一工具,我不能,我很担心。
回答by rlc
From your description, it looks like you're pushing into a remote repository that is set up to check out the files to a local working directory and the permissions in that directory don't allow the checkout. If that is the case, a well-placed chmod command should do the trick (something like chmod -R u+w *
run with the user credentials)
从您的描述来看,您似乎正在推送到一个远程存储库,该存储库设置为将文件检出到本地工作目录,并且该目录中的权限不允许检出。如果是这种情况,放置良好的 chmod 命令应该可以解决问题(例如chmod -R u+w *
使用用户凭据运行)