由于文件路径错误,Git 克隆无法正常工作 [英] Git clone is not working due to bad file path
问题描述
Git 在 Windows 10 机器上克隆存储库会引发此错误:
Git cloning the repository on a Windows 10 machine throws this error:
错误:无效路径'saleor/graphql/core/tests/cassettes/test_get_oembed_data[http://www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO].yaml'
error: invalid path 'saleor/graphql/core/tests/cassettes/test_get_oembed_data[http:/www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO].yaml'
致命:无法检出工作树
警告:克隆成功,但结帐失败.
warning: Clone succeeded, but checkout failed.
>git clone https://github.com/mirumee/saleor.git
Cloning into 'saleor'...
remote: Enumerating objects: 187180, done.
remote: Counting objects: 100% (289/289), done.
remote: Compressing objects: 100% (225/225), done.
remote: Total 187180 (delta 136), reused 131 (delta 64), pack-reused 186891
Receiving objects: 100% (187180/187180), 105.28 MiB | 234.00 KiB/s, done.
Resolving deltas: 100% (137187/137187), done.
error: invalid path 'saleor/graphql/core/tests/cassettes/test_get_oembed_data[http:/www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO].yaml'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
尝试过
我尝试了这种方法,但它没有'在最后一步工作:
Tried
I tried this approach but it didn't work at the last step:
$ git init saleor
$ cd saleor
$ git remote add origin https://gitzzz.com/yyy/saleor.git -f
到目前为止一切顺利,但此命令会引发错误:
So far so good, but this command throws error:
$ git checkout origin/master -f
error: invalid path 'saleor/graphql/core/tests/cassettes/test_get_oembed_data[http:/www.youtube.com/watch?v=dQw4w9WgXcQ-VIDEO].yaml'
尝试过
此外,这种方法也无济于事.
如何在 Windows 上克隆/签出此存储库?
How can I clone/checkout this repo on Windows?
@bk2204 建议的选项解决了这个问题:
The option suggested by @bk2204 resolved the issue:
- 分叉存储库
- 在 Linux 上克隆 fork
- 在 Linux 上更改路径名
- 提交并推送
- 然后查看 Windows 上的固定叉
推荐答案
这里的问题是路径同时包含冒号和问号,而且您可能使用的是 Windows 系统.Windows 故意决定不允许在路径名中使用这些字符,因此无法检查此文件.
The problem here is that the path contains both colons and question marks and you're likely on a Windows system. Windows has made a deliberate decision not to allow these characters in path names, so there's no way to check this file out there.
你有一些选择:
- 使用不同的操作系统,例如 macOS 或 Linux.
- 使用不受这些限制的适用于 Linux 的 Windows 子系统检查文件.
- 请负责存储库的一方更改路径名或自己在其他环境中完成,然后查看已修复的存储库.
- 要求 Microsoft 解决此问题.
- 请勿使用此存储库.
这篇关于由于文件路径错误,Git 克隆无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!