此存储库已为 Git LFS 配置,但在您的路径中未找到“git-lfs”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36848741/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
This repository is configured for Git LFS but 'git-lfs' was not found on your path
提问by Let Me Tink About It
Please help me understand what the below error message means and how to comply with its request.
请帮助我理解以下错误消息的含义以及如何遵守其要求。
I want to copy an existing local git repo; then push that copy to a newly created remote.
我想复制一个现有的本地 git 仓库;然后将该副本推送到新创建的遥控器。
But I get the following error:
但我收到以下错误:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/pre-push.
此存储库已为 Git LFS 配置,但在您的路径中未找到“git-lfs”。如果您不再希望使用 Git LFS,请通过删除 .git/hooks/pre-push 来删除此挂钩。
The code I used immediately prior to getting this message is:
我在收到此消息之前立即使用的代码是:
# create new git repo at https://github.com/username/foo-bar.git
cp -r OldProject/ NewProject/
cd NewProject/
git remote remove origin # Remove prior origin from copy operation
git init
git remote add origin https://github.com/username/foo-bar.git
git add -A
git commit -m "first commit"
git push -u origin master
What am I doing wrong and how can I fix it? Please help me understand what the above error message means and how to comply with its request.
我做错了什么,我该如何解决?请帮助我理解上述错误消息的含义以及如何遵守其要求。
回答by Dan
This repository is configured for Git LFS but 'git-lfs' was not found on your path
此存储库已为 Git LFS 配置,但在您的路径中未找到“git-lfs”
LFS is "Large File Storage," an extension for git that keeps large files outside of the actual repository so it doesn't become slow. When the error says "not found on your path," it means git was looking for a program that you don't have installed. You can install it using the instructions on https://git-lfs.github.com/.
LFS 是“大文件存储”,是 git 的扩展,可将大文件保存在实际存储库之外,因此不会变慢。当错误显示“在您的路径上找不到”时,这意味着 git 正在寻找您尚未安装的程序。您可以使用https://git-lfs.github.com/上的说明安装它。
A hook, by the way, is a bit of code git runs when you do some action. They are stored in the repository, in the hidden directory .git/hooks
.
顺便说一下,钩子是当你做一些动作时 git 运行的一些代码。它们存储在存储库中的隐藏目录中.git/hooks
。
回答by MOTYSHIZ
I think I may have solved it for people who may be using SourceTree. For me, since I installed SourceTree before git on a fresh machine, SourceTree was using an embedded version of git, which didn't have git lfs installed I guess.
我想我可能已经为可能使用 SourceTree 的人解决了这个问题。对我来说,因为我在一台新机器上安装了 git 之前的 SourceTree,SourceTree 使用的是嵌入式版本的 git,我猜它没有安装 git lfs。
So I went to Tools > Options > Git, and at the bottom I noticed some settings to choose which version of git that Sourcetree uses.: Tools > Options > Git version settings
所以我去工具>选项> Git,在底部我注意到一些设置来选择Sourcetree使用的git版本。: 工具>选项> Git版本设置
So I had previously had it on "Embedded", but I changed it to System, and things have been good so far.
所以我以前在“嵌入式”上有过它,但我把它改成了系统,到目前为止一切都很好。
While this may be fairly obvious to most, I think I will mention it anyways: This will only work if you have git and lfs installed on your system from https://git-scm.com/. The git installer has an option to install git-lfs at some point during installation.
虽然这对大多数人来说可能相当明显,但我想我还是会提到它:这只有在您的系统上从https://git-scm.com/安装了 git 和 lfs 时才有效。git 安装程序可以选择在安装过程中的某个时间点安装 git-lfs。
EDIT: So after this, the problems still persisted, but then I remembered that this issue only started after I had installed a new M.2 NVME drive and loaded my repo onto it.
编辑:所以在此之后,问题仍然存在,但后来我记得这个问题仅在我安装了新的 M.2 NVME 驱动器并将我的 repo 加载到它之后才开始。
So I guess if you run git lfs from a drive that is slower than the drive that is slower than the repo, Sourcetree will think that you don't have git lfs configured. So I uninstalled Git and LFS, and reinstalled them on my fastest drive, the M.2 NVME drive, and I haven't had any issues since.
所以我猜如果你从一个比 repo 慢的驱动器运行 git lfs 的驱动器,Sourcetree 会认为你没有配置 git lfs 。所以我卸载了 Git 和 LFS,并在我最快的驱动器 M.2 NVME 驱动器上重新安装了它们,从那以后我没有遇到任何问题。
回答by Harvey
I had the same problem, and solved it by deleting .git/hooks/pre-push
我遇到了同样的问题,通过删除 .git/hooks/pre-push 解决了