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

5

14

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?

Jackanapes answered 4/10, 2013 at 11:56 Comment(0)
R
7

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.

Ramiah answered 7/11, 2013 at 2:9 Comment(2)
Having the same issue but with essential theme files, and cloning into C:\ doesn't fix it. so I assume it's not the long-path issue. Ended up having to use a linux virtual box to work with this repo on Windows, but there's got to be a better way...?Sinfonia
@MikeLyons, unfortunately, I haven't found a better way, except cygwin(which can be a large install), but uses UNC paths. If you run across one, please share, and we will all cheer. A lot of the windows APIs have that 259 char limit, which is what git is running into.Ramiah
E
28

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.

Edentate answered 18/5, 2017 at 14:54 Comment(1)
In my case, I had a command prompt which was executing ionic serve which I had to stop..Paulinepauling
R
7

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.

Ramiah answered 7/11, 2013 at 2:9 Comment(2)
Having the same issue but with essential theme files, and cloning into C:\ doesn't fix it. so I assume it's not the long-path issue. Ended up having to use a linux virtual box to work with this repo on Windows, but there's got to be a better way...?Sinfonia
@MikeLyons, unfortunately, I haven't found a better way, except cygwin(which can be a large install), but uses UNC paths. If you run across one, please share, and we will all cheer. A lot of the windows APIs have that 259 char limit, which is what git is running into.Ramiah
P
1

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.

Puritanism answered 29/8, 2019 at 14:12 Comment(0)
C
0

I recently has this problem,
and tried running all sorts of commands within git bash on windows 10.
But none work, and here's what I tried to resolve this.

  • Restart the machine, simple!
    Sometimes the background processes are so many, or intensive that you can no longer stop them.

  • After restart, launch the cmd or cli to run as administrator

  • Run git checkout -f <branch>
    All the changes, if unwanted, will be abandoned in this process.

  • Once in a new branch, you can then git branch -D <branch> since you want to drop it.

Costanzo answered 15/4, 2020 at 15:11 Comment(0)
Q
0

In my case, I did the following and then it worked.

  1. Close the any application which is currently using/holding the file. For me it was Matlab.
  2. I wanted for "git pull" hence I stored my related file changed files to a different location and revert all my changes in that folder.
  3. And then perform git pull and works fine.
Quianaquibble answered 16/6, 2020 at 8:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.