无法将所有文件添加到云 GIT 存储库

Not able to add all the files to Cloud GIT Repository

我在本地的 Spark Scala 上有一个项目 运行ning。我能够毫无问题地成功构建它。

我在将该项目复制到本地的 git 文件夹时遇到问题。它说某些文件名太长。所以我不得不跳过这些文件来完成复制任务。

那不是我面临的实际问题。当我 运行:

将项目目录复制到本地 git 文件夹后
git add spark-pm-cm/

我不断收到一些警告和错误消息,例如:

warning: LF will be replaced by CRLF in spark-pm-cm/null/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-sbt/ipcsocket/ipcsocket/1.0.0/ipcsocket-1.0.0.pom.
The file will have its original line endings in your working directory

The file will have its original line endings in your working directory
error: open("spark-pm-cm/null/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-sbt/ivy/ivy/2.3.0-sbt-cb9cc189e9f3af519f9f102e6c5d446488ff6832/.ivy-2.3.0-sbt-cb9cc189e9f3af519f9f102e6c5d446488ff6832.jar.checked"): Filename too long
error: unable to index file 'spark-pm-cm/null/Coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-sbt/ivy/ivy/2.3.0-sbt-cb9cc189e9f3af519f9f102e6c5d446488ff6832/.ivy-2.3.0-sbt-cb9cc189e9f3af519f9f102e6c5d446488ff6832.jar.checked'
fatal: adding files failed

我正在尝试将此代码推送到 Google 云上的 Git 存储库。

如果您是在 windows 机器上工作的单个开发人员,并且您不关心 git 自动将 LF 替换为 CRLF,您可以通过在git 命令行

git config core.autocrlf true

Git 的文件名限制为 4096 个字符,但在 Windows 上除外,因为 Git 是使用 msys 编译的。它使用 Windows API 的旧版本并且文件名有 260 个字符的限制。

git config --system core.longpaths true

运行 在您的 git bash 中以管理员身份执行这些命令应该可以完成工作!