github/git Checkout 在 Windows 上返回“错误:路径无效" [英] github/git Checkout Returns 'error: invalid path' on Windows

查看:92
本文介绍了github/git Checkout 在 Windows 上返回“错误:路径无效"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试从 github 签出存储库时出现错误:

When I attempt to checkout a repository from github I get the error:

error: invalid path 'configs/perl-modules/DIST.64/perl-HTML-Tree-1:5.03-1.el6.noarch.rpm'

我怀疑问题是路径包含一个 : 这在 Windows 上是非法的.

I suspect the issue is that the path contains a : which is illegal on Windows.

在研究错误后,我找到了 2 个可能的答案:
1) 更改存储库文件的路径.不幸的是,这是团队资源,在可预见的未来无法修复.
2) 使用 sparse-checkout. 我已经尝试过没有效果,如下所示:

After researching the error, I've found 2 possible answers:
1) Change the path on the repository file. Unfortunately, this is is a team resource and can not be fixed in the foreseeable future.
2) Use sparse-checkout. I've tried this with no effect as evidenced in the following:

$ git clone -n​​ git@github.com:XXXXXX/deploy.git
克隆到部署"...
远程:枚举对象:57,完成.
远程:计数对象:100% (57/57),完成.
远程:压缩对象:100% (49/49),完成.
远程:总计 86457(增量 10),重用 22(增量 8),打包重用 86400
接收对象:100% (86457/86457),1.50 GiB |4.73 MiB/s,完成.
解析增量:100% (59779/59779),完成.
$ cd deploy/
$ git config core.sparsecheckout 真
$回声www >>.git/info/sparse-checkout
$ git checkout centos6
错误:无效路径configs/perl-modules/DIST.64/perl-HTML-Tree-1:5.03-1.el6.noarch.rpm"
错误:无效路径 'configs/perlbrew/perls/perl-5.24.1/man/man3/App::Cpan.3'
.
.(对许多文件重复)
.

$ git clone -n git@github.com:XXXXXX/deploy.git
Cloning into 'deploy'...
remote: Enumerating objects: 57, done.
remote: Counting objects: 100% (57/57), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 86457 (delta 10), reused 22 (delta 8), pack-reused 86400
Receiving objects: 100% (86457/86457), 1.50 GiB | 4.73 MiB/s, done.
Resolving deltas: 100% (59779/59779), done.
$ cd deploy/
$ git config core.sparsecheckout true
$ echo www >> .git/info/sparse-checkout
$ git checkout centos6
error: invalid path 'configs/perl-modules/DIST.64/perl-HTML-Tree-1:5.03-1.el6.noarch.rpm'
error: invalid path 'configs/perlbrew/perls/perl-5.24.1/man/man3/App::Cpan.3'
.
. (repeat for many files)
.

这是使用 Git for Windowsgit version 2.28.0.windows.1"完成的.我也尝试过两种类型的行尾并使用各种版本的 .git/info/sparse-checkout 例如:

This was done with Git for Windows "git version 2.28.0.windows.1". I have also tried both types of line endings and using various version of .git/info/sparse-checkout such as:

/*
!/configs/perl-modules
!/configs/perlbrew/perls/perl-5.24.1/man/man3

Checkout 在 Linux、MacOS 和 WSL 上运行良好,唯一的问题是我的 IDE 不能在那里运行.为什么 sparse-checkout 在 Windows 上不起作用.还有其他可能吗?

Checkout works fine on Linux, MacOS and WSL, only problem is that my IDEs don't work there. Why isn't sparse-checkout working on Windows. Is there any other possibilities?

推荐答案

在我在 git-for-windows 错误跟踪器 (https://github.com/git-for-windows/git/issues/2803),我发现我的问题已经提交为 https://github.com/git-for-windows/git/issues/2777.该问题表明我需要设置另一个 git 标志:

After I opened an issue on the git-for-windows bug tracker (https://github.com/git-for-windows/git/issues/2803), I found that my issue had already been filed as https://github.com/git-for-windows/git/issues/2777. That issue suggested that I need to set another git flag:

git config core.protectNTFS false

这 (#2777) 确实包含了我的问题的绕过.我希望 git 或 git-for-windows(响应迅速)提出更好的警告消息,甚至像文件路径映射方案这样的真正修复.

This (#2777) indeed contains a bypass for the my problem. I hope the git or git-for-windows (who were very responsive) come up with a better warning message, or even a true fix like a filepath mapping scheme.

请注意,这只是在 Windows 中使用 sparse-checkout 时的问题.

Note that this is only an issue when using sparse-checkout with windows.

这篇关于github/git Checkout 在 Windows 上返回“错误:路径无效"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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