【问题标题】:Not able to add all the files to Cloud GIT Repository无法将所有文件添加到 Cloud GIT 存储库
【发布时间】:2021-06-16 11:35:43
【问题描述】:

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

我在将该项目复制到本地本身的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,您可以更改 MAX_PATH 限制:docs.microsoft.com/en-us/windows/win32/fileio/…
  • @John Hanley.. 这听起来不错,不确定我们的管理员是否会允许这样做。我一定会检查这一点。谢谢
  • 另一个想法是不提交 Scala 缓存。您不需要将这些文件保存在存储库中。

标签: git google-cloud-platform maven-2 sbt-assembly


【解决方案1】:

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

git config core.autocrlf true

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

git config --system core.longpaths true

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-23
    • 2018-05-14
    • 2017-02-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多