微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决无法将所有文件添加到 Cloud GIT 存储库

我在本地的 Spark Scala 上运行了一个项目。我能够成功地构建它,没有任何问题。

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

enter image description here

嗯,这不是我面临的实际问题。运行时将项目目录复制到本地 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 Cloud 上的 Git 存储库。

解决方法

如果您是在 windows 机器上工作的单个开发人员,并且您不关心 git 自动将 LFs 替换为 CRLFs,您可以通过在 git 命令行中键入以下内容来关闭此警告

git config core.autocrlf true

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

git config --system core.longpaths true

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。