为什么我得到“无法创建目录"?结帐时,一个git远程分支窗口? [英] Why do I get "cannot create directory" when checkout a git remote branch windows?

查看:71
本文介绍了为什么我得到“无法创建目录"?结帐时,一个git远程分支窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 10 64Bit上使用git版本2.10.2.windows.1.

I am on Windows 10 64Bit using git version 2.10.2.windows.1.

在MACOS上,我们将两个分支合并为一个现有分支.合并后,分支包含一个文件夹,末尾带有空白(" Jadise/").我基于Bitbucket上的先前合并创建了一个新分支. 现在,当我尝试在Windows下签出新分支时,出现此错误:

On MACOS we merged two branches into an existing branch. After merge the branch contains a folder with a white space at the end ("Jadise /"). I created a new branch based on the former merges on Bitbucket. Now, when I try to checkout my new branch under Windows I get this error:

fatal: cannot create directory at 'wp-content/plugins/orbitvu-sh/_orbitvu_presentations/Jadise /_orbitvu_resized_images'

这是我尝试签出到新的远程分支机构的方式

Here is the way how I tried to checkout to the new remote branch

git fetch git checkout new-branch

似乎此错误不是指Windows中的最大路径长度.当我将存储库也放到卷的根目录中时,错误就被抛出了,就像在原始项目文件夹"中一样,我发现了这个问题.我也不认为此错误与访问问题有关,因为所有其他目录的创建/更新都没有问题.

It seems like this error is not refering to maximum path length in windows. As I put the repository also into the root of the volume and the error was thrown at the same point like being in the "original project folder" where I discovered this issue. I also don´t think that this error is related to access issues, as all the other directories have been created/updated without any issue.

您可能会注意到,这是wordpress的插件,由第三方维护.这就是为什么我不能简单地更改目录名称的原因,因为它可能会停止工作.同时,我需要它的内容才能正常工作.

As you might notice this is a plugin for wordpress and is maintained by a third party. This is the reason why I cannot simply change the directory name as it probably would stop working. At the same time I need the content of it in order to have a working build.

我克隆了项目,并切换到debian虚拟机中的分支,并且该项目可以正常工作.看来debian(或非git Windows/不确定是Windows发行版还是git发行版)能够以某种方式处理此目录名称.当我想进入cd时,使用制表符自动完成时会显示"Jasmine \/".

I cloned the project and switched to the branch in a debian virtual machine, and it worked without any issues. It seems like debian (or non git Windows / not sure if it is a windows issue or git issue) is capable of handling this directory name somehow. When I want to cd into it shows me "Jasmine\ /" when I use tab to autocomplete.

这是Windows还是git问题,有没有一种方法可以解决Windows 10 64bit而不重命名第3方插件的文件夹的问题?

Is this a windows issue or a git issue, and is there a way to solve it for Windows 10 64bit without renaming the folder of a 3rd party plugin?

推荐答案

当前,用于Windows的git UNC路径技巧闯入NTFS.如果您碰巧有这样的路径,并且这不是一些错误,则可能该项目不打算在Windows上使用.

Currently, git for windows does not support trailing spaces in filenames, and there is a reason for it: Win32 does not handle such paths, though you could break through to NTFS using the "\\?\..." UNC path trick. If you happen to have such path, and it is not some mistake, probably the project is not intended to be used at Windows.

据了解,您有以下选择:

As far as understand, you have the following options:

  • ask project author to rename the file/directory in question or do it yourself
  • try using git from a cygwin/msys2 build. The msys2 wrapper handles some Windows path issues, transforming them into legal ones, though I don't know if it handles this issue.
  • fix git for windows - take into use the UNC path. The maintainer said he would consider taking such patch.
  • if you don't really need to work on the file or directory, you could exclude it from checkout using sparse checkout.

这篇关于为什么我得到“无法创建目录"?结帐时,一个git远程分支窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆