espressif / book-esp32c3-iot-projects

《ESP32-C3 物联网工程开发实战》配套代码
97 stars 29 forks source link

windows下 clone 仓库时报错 #2

Closed lituo666 closed 1 year ago

lituo666 commented 1 year ago

windows 11 环境,使用Git Bash 克隆仓库时报错

$ git clone https://github.com/espressif/book-esp32c3-iot-projects.git
Cloning into 'book-esp32c3-iot-projects'...
remote: Enumerating objects: 1508, done.
remote: Counting objects: 100% (1508/1508), done.
remote: Compressing objects: 100% (963/963), done.
remote: Total 1508 (delta 518), reused 1504 (delta 514), pack-reused 0
Receiving objects: 100% (1508/1508), 6.19 MiB | 2.03 MiB/s, done.
Resolving deltas: 100% (518/518), done.
error: invalid path 'phone_app/app_ios/ESPRainMaker/RainMaker+NotificationExtension/Extensions/Array<String>+CombinedString.swift'
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 :/'

仓库目录下是空的,然后我按照网上解决方案操作后还是有个问题,操作步骤如下:

$ cd book-esp32c3-iot-projects/

$ git config core.protectNTFS false

$ git checkout
error: unable to create file phone_app/app_ios/ESPRainMaker/RainMaker+NotificationExtension/Extensions/Array<String>+CombinedString.swift: Invalid argument
D       phone_app/app_ios/ESPRainMaker/RainMaker+NotificationExtension/Extensions/Array<String>+CombinedString.swift
Your branch is up to date with 'origin/main'.

然后目录下就有文件了,但还是有个文件无法创建。

fanbaoying commented 1 year ago

warning: Clone succeeded, but checkout failed.

项目 Clone 已经完成,系统 checkout 失败。看一下能不能把系统的 checkout 关掉。

上面的截图是我本地尝试 clone 的情况。没有问题

lituo666 commented 1 year ago

仓库里这个文件

phone_app/app_ios/ESPRainMaker/RainMaker+NotificationExtension/Extensions/Array<String>+CombinedString.swift

的名字里有 <> 尖括号,windows 下不能使用这个特殊符号,这个文件无法 chekout 导致在 clone 时报错,最后 book-esp32c3-iot-projects 目录下是空的。

建议修改一下文件名。

目前只能跳过这个文件的检出,进入目录后,使用下面命令

git config --global core.protectNTFS false 忽略路径中的转义字符,

git checkout 再次检出就可以了。

fanbaoying commented 1 year ago

Array+CombinedString.swift 文件名字是 iOS App 项目创建自动生成,不能更改。否则项目编译无法通过