Github无效路径错误 – 无法将存储库克隆到GitHub桌面

huangapple go评论46阅读模式
英文:

Github invalid path error - unable to clone repository into GitHub Desktop

问题

抱歉,以下是您要的内容的翻译部分:

我是GitHub的新手,尝试将我的团队存储库克隆到我的GitHub桌面。但是,我遇到了以下错误。

克隆到 'C:\Users\prisc\github\sex-bias\sex.bias'...
远程: 正在枚举对象: 809, 完成。        
远程: 正在计数对象: 100% (29/29), 完成。        
远程: 正在压缩对象: 100% (24/24), 完成。        
远程: 共计 809 个对象 (差异 8),重新使用了 22 个对象 (差异 5),重新使用了 780 个对象包        
接收对象: 100% (809/809),206.22 MiB | 30.22 MiB/s,完成。
解决差异: 100% (340/340),完成。
错误: 无效路径 'Icon?'
致命错误: 无法检出工作树
警告: 克隆成功,但检出失败。
您可以使用 'git status' 检查检出了什么
然后使用 'git restore --source=HEAD :/' 重试。

有什么想法吗?我还尝试了从终端克隆,但是出现相同的错误。

谢谢,
Pri
英文:

I am new to GitHub and trying to clone my team's repository into my GitHub Desktop. However, I get the following error.

Cloning into 'C:\Users\prisc\github\sex-bias\sex.bias'...
remote: Enumerating objects: 809, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 809 (delta 8), reused 22 (delta 5), pack-reused 780
Receiving objects: 100% (809/809), 206.22 MiB | 30.22 MiB/s, done.
Resolving deltas: 100% (340/340), done.
error: invalid path 'Icon?'
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 :/'

Any ideas what is happening? I've also tried cloning from the terminal and get the same error.

Thanks,
Pri

答案1

得分: 1

克隆过程成功,表示问题与 Git 凭证或网络连接无关。但是,检出过程失败。这是什么意思?这意味着如果你在资源管理器中导航到克隆存储库的文件夹,你将找不到任何写入磁盘的文件。

这个错误表明您的文件名路径中存在错误或某处存在尾随空格。

您遇到此错误的原因是 Windows 不支持尾随空格字符,并在保存文件时自动删除它们。另一方面,Linux 支持文件名中的前导和尾随空格。

Git 知道这些限制,并有一个特殊的配置设置来控制它:

core.protectNTFS

如果设置为 true,不允许检出可能导致 NTFS 文件系统问题的路径,例如与 8.3 "短" 名称冲突。在 Windows 上默认为 true,在其他地方默认为 false。

其他人能够克隆存储库而没有问题的原因是 core.protectNTFS 被设置为 false(手动设置或由于底层操作系统设置)。

因此,要在 Windows 上克隆存储库,您可以使用以下命令:

git clone -c core.protectNTFS=false <存储库 URL>

英文:

The cloning process succeeded, indicating that the issue is not related to Git credentials or network connectivity. However, the checkout process failed. What does this mean? It means that if you navigate to the folder of the cloned repository in the explorer, you won’t find any files written to the disk.
This error suggests that you have some error in the file name path or some trailing whitespace somewhere.

The reason why you get the error is that Windows doesn’t support trailing space characters and automatically removes them when saving a file. On the other hand, Linux does support both leading and trailing whitespaces in filenames.

Git knows about these limitations and has a special config setting to control it:

core.protectNTFS

If set to true, do not allow checkout of paths that would cause problems with the NTFS filesystem, e.g. conflict. with 8.3 “short” names. Defaults to true on Windows, and false elsewhere.

The reason why other people can clone the repo without issues is that core.protectNTFS is set to false (manually or because of underlying OS)

So, to clone the repo on Windows you can use the following command:

git clone -c core.protectNTFS=false &lt;repo url&gt;

huangapple
  • 本文由 发表于 2023年2月14日 01:47:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/75439493.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定