【问题标题】:Git clone git-lfs filter-process: git-lfs: command not foundGit clone git-lfs filter-process: git-lfs: command not found
【发布时间】:2021-05-05 04:38:48
【问题描述】:

我正在尝试通过以下方式从 git 克隆一个项目:

git clone link

收到这条消息

remote: Enumerating objects: 24533, done.
remote: Counting objects: 100% (24533/24533), done.
remote: Compressing objects: 100% (5045/5045), done.
remote: Total 24533 (delta 15448), reused 24389 (delta 15306), pack-reused 0
Receiving objects: 100% (24533/24533), 75.12 MiB | 10.96 MiB/s, done.
Resolving deltas: 100% (15448/15448), done.
git-lfs filter-process: git-lfs: command not found
fatal: the remote end hung up unexpectedly
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

我一直在四处寻找并尝试过:

git config --system core.longpaths true

但它不起作用,我的磁盘有很多空闲

【问题讨论】:

  • 你安装了 Git-LFS 吗? (这是一个独立于 Git 的程序,显然你使用的任何软件都需要它。)

标签: git-lfs


【解决方案1】:

如果您使用的是 Mac,请运行:

brew install git-lfs
git lfs install

【讨论】:

  • 谢谢,这似乎对我有用。我不知道这是一个单独的程序。我认为每个编写“文档”的人都安装了它,所以他们不记得让新人安装它。
  • 谢谢,有帮助!有类似的问题,但git restore
  • 在 Windows 上,我刚刚通过安装程序重新安装了 git,并在“选择组件”步骤中选择了 Git LFS (Large File Support) 选项,它工作了
【解决方案2】:

TL;DR

也许git 没有链接到机器上的git-lfs。尝试链接它:

ln -s "$(which git-lfs)" "$(git --exec-path)/git-lfs"

说明

虽然它说缺少一些东西,但 git-lfs 实际上可以安装在机器上,但 git 只是没有在其搜索路径中找到它。因此,我们在其搜索路径中创建一个符号文件:

$(git --exec-path)/git-lfs

链接到机器上通常安装的一个:

which git-lfs

【讨论】:

  • 谢谢!!只有你的变种帮助了我!
  • 优雅的解决方案。我在使用自制软件安装 git-lfs 时遇到了这个问题。所以,Xcode 附带的 git 并没有意识到这一点。链接它们解决了这个问题。不过,我不确定 Xcode 更新后问题是否会再次出现。
  • 这个很重要,大家都知道怎么安装git-lfs但是不知道android studio版本控制等其他程序也需要链接。
【解决方案3】:

您可能会尝试推送包含巨大文件的存储库。所以,在这种情况下,我们必须安装 git-lfs

对于 Windows:

  • 从官方网站 (download) 下载 git-lfs 并安装到你的机器上。

  • 然后通过在终端中运行以下命令为您的用户帐户设置 Git LFS:

    git lfs install
    

对于 Mac:

  • 在终端中运行以下命令。

    brew install git-lfs
    git lfs install
    

对于 Ubuntu:

  • 在终端中运行以下命令。

    sudo apt install git-lfs
    git lfs install
    

【讨论】:

    【解决方案4】:

    遇到同样的问题,Teodoriko的回答对我不起作用得到了结果:

    git: 'lfs' is not a git command. See 'git --help'.
    

    对我有用的是安装依赖项:

    sudo apt install git-lfs
    

    我的git版本2.27.0

    【讨论】:

      【解决方案5】:

      这是一个简单的。根据您的操作系统检查安装类型的文档。对于 linux,只需遵循以下命令:

      1. 下载并安装 Git 命令行扩展。下载后 并安装,通过运行为您的用户帐户设置 Git LFS:

        git lfs install
        

      每个用户帐户只需运行一次。

      1. 在您要使用 Git LFS 的每个 Git 存储库中,选择 您希望 Git LFS 管理的文件类型(或直接编辑您的 .git 属性)。您可以在以下位置配置其他文件扩展名 随时。

        git lfs track "*.psd"
        

      现在确保 .gitattributes 被跟踪:

        git add .gitattributes
      

      请注意,定义 Git LFS 应跟踪的文件类型本身不会将任何预先存在的文件转换为 Git LFS,例如其他分支上的文件或您之前的提交历史记录中的文件。为此,请使用 git lfs migrate[1] 命令,该命令具有一系列选项,旨在适应各种潜在用例。

      1. 没有第三步。只需提交并推送到 GitHub 通常会;例如,如果您当前的分支名为 main:

        git add file.psd
        
        git commit -m "Add design file"
        
        git push origin main
        

      参考:https://git-lfs.github.com/

      【讨论】:

        猜你喜欢
        • 2022-06-14
        • 2019-09-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-31
        • 2020-11-29
        相关资源
        最近更新 更多