fatal: cannot create directory at /root/wp-content/cache/page_enhanced/… No such a file or directory

亡梦爱人 提交于 2019-12-01 01:12:02

问题


After some pulling changes from server.

I can not anymore push anything no matter If I am trying git git push or git pull or git merge or git rebase origin/master or git reset --hard

It always says fatal: cannot create directory at /root/wp-content/cache/page_enhanced/.... No such a file or directory

Even when I create new clean repository and trying to clone it still gets same error.

How I can solve this... Anyway this is some cache directory and I don't need it... How to drop or ignore it?


回答1:


Could be several things depending on the OS of the machine you are running and version of git. With more detail I could be more specific.

On Windows,it's either the permissions of the directories, or it's the length of the directories/paths. On Linux, it would be the permissions. I've also seen cases where the problem is non-allowed characters in directories or files.

Your best bet to remove the directory is to clone it somewhere that works, like a linux box running root (or a vm or run cygwin), and add this to the .gitignore file: /wp-content/cache/.

Then, to remove the already cached info, type: git rm -rf –-cached wp-content/cache and then commit and push.




回答2:


I had a similar problem. I found that I had to close Visual Studio because it was holding onto the directory.

I recommend that you close all the programs you can if you run into this problem. If your issue is the same as mine you will be able to able to execute your git commands when the program holding on to the reference is shutdown. If you do it systematically then you should find the offender as well.




回答3:


My solution - as weird as it seems - was to create the directory manually.

My problem was the same "can't create directory" thing during branch checkout operation. After creating the directory manually I was able to perform git checkout successfuly.



来源:https://stackoverflow.com/questions/19180612/fatal-cannot-create-directory-at-root-wp-content-cache-page-enhanced-no-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!