简体   繁体   English

git pull不适用于kubuntu / var / www / html文件夹中的删除

[英]git pull doesn't apply deletions in kubuntu /var/www/html folder

It fails with warning: unable to unlink ... Permission denied 它失败并显示警告:无法取消链接...权限被拒绝

Order of operations: 操作顺序:

Deleted some files, added the deleted files to staged files. 删除一些文件,将删除的文件添加到暂存文件中。

# On 1st local remote repository:*
git commit -m "deletion of folder with files"

# pushed to remote repository
git push origin branchName

# On local repository
git pull 

gives the error: warning: unable to unlink ... Permission denied 给出错误: 警告:无法取消链接...权限被拒绝

I see that the files were not deleted. 我看到文件没有被删除。
Maybe it's related to the fact that repository is in /var/wwww/html ? 也许与存储库位于/var/wwww/html这一事实有关?
Usually i make changes with sudo there. 通常,我在那里用sudo进行更改。 It seems also that change was applied in index after running: 在运行后,似乎也对索引应用了更改:

git log -1

How to correctly apply this deletion by git pull ? 如何通过git pull正确应用此删除? Running git pull now returns 运行git pull现在返回

Already up-to-date.

Your issue here is operating system permissions. 您的问题是操作系统权限。 It has nothing to do with git. 它与git无关。 If you look at your git status for that repo, you will likely see the files in /var/www/html as new untracked files as git thinks you've already deleted them. 如果您查看该存储库的git状态,则可能会在/ var / www / html中将这些文件视为新的未跟踪文件,因为git认为您已将其删除。 I would recommend finding a user that has the appropriate permissions and deleting them manually, or running something like the following: 我建议您找到具有适当权限的用户,然后手动将其删除,或者运行类似以下内容的用户:

sudo git reset --hard && git clean -fdx .

WARNING: This command will delete any non-tracked files and reset any tracked changes. 警告:此命令将删除所有未跟踪的文件并重置所有跟踪的更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM