Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

After some pulling changes from server.

I can not any more push anything no matter if I try these:

  • 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 clone, it still gets same error.

How I can solve this?
Any way this is some cache directory and I don't really need it, how to drop or ignore it?

like image 869
Arma Sarma Avatar asked Oct 04 '13 11:10

Arma Sarma


2 Answers

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.

like image 174
John Braxler Avatar answered Sep 23 '22 23:09

John Braxler


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.

like image 44
Mike Avatar answered Sep 24 '22 23:09

Mike