git 致命:无法在 /root/wp-content/cache/page_enhanced/ 创建目录 没有这样的文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19180612/
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
fatal: cannot create directory at /root/wp-content/cache/page_enhanced/ No such a file or directory
提问by Arma Sarma
After some pulling changes from server.
从服务器中提取更改后。
I can not any more push
anything no matter if I try these:
push
无论我是否尝试这些,我都无法再做任何事情:
git push
orgit pull
orgit merge
orgit rebase origin/master
orgit reset --hard
git push
或者git pull
或者git merge
或者git rebase origin/master
或者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.
即使当我创建新的干净存储库 和 时clone
,它仍然会出现相同的错误。
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?
我该如何解决这个问题?
无论如何,这是一些缓存目录,我真的不需要它,如何删除或忽略它?
采纳答案by Mike
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.
根据您正在运行的机器的操作系统和 git 版本,可能有几件事。有了更多细节,我可以更具体。
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.
在 Windows 上,它要么是目录的权限,要么是目录/路径的长度。在 Linux 上,这将是权限。我还见过问题出在目录或文件中不允许使用的字符的情况。
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/
.
要删除的目录你最好的赌注是什么地方克隆它的作品,像跑步根Linux机器(或虚拟机或运行Cygwin的),并且将其添加到.gitignore文件以:/wp-content/cache/
。
Then, to remove the already cached info, type:
git rm -rf –-cached wp-content/cache
and then commit and push.
然后,要删除已经缓存的信息,请键入:
git rm -rf –-cached wp-content/cache
然后提交并推送。
回答by John Braxler
I had a similar problem. I found that I had to close Visual Studio because it was holding onto the directory.
我有一个类似的问题。我发现我必须关闭 Visual Studio,因为它保留在目录中。
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.
如果遇到此问题,我建议您关闭所有可以关闭的程序。如果您的问题与我的相同,您将能够在保留引用的程序关闭时执行 git 命令。如果你系统地这样做,那么你也应该找到罪犯。
回答by Landeeyo
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.
我的问题是在分支结帐操作期间相同的“无法创建目录”。手动创建目录后,我能够成功执行 git checkout。
回答by MwamiTovi
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.
我最近遇到了这个问题,
并尝试在git bash
on 中运行各种命令windows 10
。
但没有工作,这就是我试图解决这个问题的方法。
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
orcli
torun 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 thengit branch -D <branch>
since you want to drop it.
重启机器,简单!
有时后台进程太多或密集,您无法再阻止它们。重新启动后,启动
cmd
或cli
至run as administrator
运行
git checkout -f <branch>
所有更改,如果不需要,将在此过程中放弃。一旦进入
new
分支,您就可以git branch -D <branch>
删除它。