简体   繁体   English

git:'lfs' 不是 git 命令不清楚

[英]git: 'lfs' is not a git command unclear

Every time I enter in my command window每次我输入命令 window

git lfs install

the message I get is git: 'lfs' is not a git command.我收到的消息是 git: 'lfs' is not a git 命令。 See 'git --help'.请参阅“git --help”。

I tried looking up for a solution, but none of the answers were clear.我试图寻找解决方案,但没有一个答案是明确的。 Can someone explain clear how to fix this?有人可以解释清楚如何解决这个问题吗?

It looks like you haven't downloaded git-lfs on your machine, so git lfs install isn't a registered command by git.看起来你还没有在你的机器上下载 git-lfs,所以git lfs install不是 git 的注册命令。

Install git-lfs as outlined below:安装 git-lfs 如下所述:


1. Pre-Requisites 1. 先决条件

  • git-lfs requires git version 1.8.2 or later. git-lfs 需要git版本 1.8.2 或更高版本。 You can check the version you have by running git --version , and update if required.您可以通过运行git --version检查您拥有的版本,并在需要时进行更新。
  • If you are installing on macOS, make sure you have Homebrew installed.如果您在 macOS 上安装,请确保您已安装Homebrew

2. Download 2. 下载

Download git-lfs by following the steps based on your operating system.根据您的操作系统按照步骤下载 git-lfs。

Debian / Ubuntu Debian / Ubuntu

$ curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
$ sudo apt-get install git-lfs

MacOS (Using Homebrew) MacOS(使用自制软件)

$ brew update
$ brew install git-lfs

Windows视窗

Download and run the latest windows installer .下载并运行最新的windows 安装程序

3. Install 3.安装

Finally, run git-lfs install to install git-lfs on your system.最后,运行git-lfs install在你的系统上安装git-lfs You can always run git-lfs uninstall to uninstall.您始终可以运行git-lfs uninstall来卸载。


More detailed information (such as for installation on other platforms) can be found on git-lfs's installation page .更详细的信息(例如在其他平台上的安装)可以在 git-lfs 的安装页面上找到。

You can't directly use不能直接使用

git lfs install

Instead of that, you can use these commands to download and install (you have to download it before installing).取而代之的是,您可以使用这些命令来下载和安装(您必须在安装之前下载它)。

sudo apt-get install git-lfs
git-lfs install

除了“arct”答案,如果你有一台 M1 Silicone Mac,你必须使用以下使用 homebrew 安装它

arch -arm64 brew install git-lfs

LFS is not part of Git, it needs to be installed separately. LFS 不是 Git 的一部分,它需要单独安装。 See the Git LFS site .请参阅Git LFS 站点 Following the 'Getting Started' instructions for your platform should resolve the issue.遵循您平台的“入门”说明应该可以解决该问题。

none of those pages specify how to install.这些页面都没有指定如何安装。 They just say download and install.他们只是说下载和安装。 I'm running in circles here.我在这里兜圈子。 Quite frustrating.相当令人沮丧。 Download and install, but no mention in getting started as to HOW to install.下载并安装,但在入门中没有提及如何安装。

"Download and install the Git command line extension. Once downloaded and installed, set up Git LFS for your user account by running: git lfs install" “下载并安装 Git 命令行扩展。下载并安装后,运行以下命令为您的用户帐户设置 Git LFS:git lfs install”

Sure I can download, but nothing I'm attempting will install.当然我可以下载,但我尝试的任何东西都不会安装。 Brew won't recognize the commands, nor will mac port. Brew 不会识别命令,mac 端口也不会。 cd to the location of the folder. cd 到文件夹的位置。 Attempt again.再试一次。 Nothing.没有什么。 Not even when running git-lfs from the download and reading those directions is there any clarity.即使从下载中运行 git-lfs 并阅读这些说明,也没有任何清晰度。 "To get started with Git LFS, the following commands can be used..." They don't work. “要开始使用 Git LFS,可以使用以下命令……”它们不起作用。 Can't enter commands in the git-lfs window, nor are they recognized in bash.无法在 git-lfs 窗口中输入命令,也无法在 bash 中识别。

Thanks.谢谢。


Had to go here to find an answer to that assumed process:不得不去这里找到这个假设过程的答案:

https://www.addictivetips.com/mac-os/run-shell-sh-script-on-macos/ https://www.addictivetips.com/mac-os/run-shell-sh-script-on-macos/

How to run a Shell or .sh script on macOS如何在 macOS 上运行 Shell 或 .sh 脚本

cd ~/Downloads/git-lfs-darwin-amd64-v2.13.2 cd ~/Downloads/git-lfs-darwin-amd64-v2.13.2

chmod +x install.sh chmod +x install.sh

sh install.sh sh install.sh

I had this when building with Atlassian Bamboo and the resolution was to build first time without lfs checked (advanced options).我在使用 Atlassian Bamboo 构建时遇到了这个问题,解决方案是在没有检查 lfs 的情况下首次构建(高级选项)。 After that you can go back and select lfs and it fetches fine from git without the lfs error.之后,您可以返回并选择 lfs,它可以从 git 中正常获取,而不会出现 lfs 错误。

Note if you are on Apple Silicon (eg M1), and using homebrew installed in the default way, homebrew will be installed at /opt/homebrew .请注意,如果您使用的是 Apple Silicon(例如 M1),并且使用以默认方式安装的 homebrew,则 homebrew 将安装在/opt/homebrew (See https://docs.brew.sh/Installation ). (请参阅https://docs.brew.sh/Installation )。

This path ( /opt/homebrew ) is not part of the default PATH env variable.此路径 ( /opt/homebrew ) 不是默认PATH环境变量的一部分。 Looks like this causes issues in git recognizing lfs in subsequent git lfs ... commands.看起来这会导致 git 在后续git lfs ...命令中识别 lfs 出现问题。

Fix is to include it in the path: export PATH=$PATH:/opt/homebrew/bin .修复方法是将其包含在路径中: export PATH=$PATH:/opt/homebrew/bin And then do the git lfs ... operations.然后执行git lfs ...操作。

Here is a solution for people installing git-lfs on a system without "sudo".这是人们在没有“sudo”的系统上安装 git-lfs 的解决方案。 Basically, it is to download the latest tarball (from here ), uncompress it, add it to your environment PATH, and install it to git.基本上,就是下载最新的tarball(从这里),解压,添加到你的环境PATH,然后安装到git。 It worked for me, at least.至少它对我有用。

wget https://github.com/git-lfs/git-lfs/releases/download/v3.2.0/git-lfs-linux-amd64-v3.2.0.tar.gz
tar -xzf git-lfs-linux-amd64-v3.2.0.tar.gz
PATH=$PATH:/export/fs04/a12/rhuang/git-lfs-3.2.0/
git lfs install
git lfs version

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM