GIt用LFS链接替换本地文件 [英] GIt Replaces Local Files With LFS Links

查看:361
本文介绍了GIt用LFS链接替换本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的存储库上启用了git LFS一段时间了,它一直运行良好.最近,我遇到了用链接替换本地文件的问题.

I have had git LFS enabled on my repository for a while and it has always worked perfectly. Recently, I have been having issues where my local files are being replaced with links.

例如,我有一个png文件,由于不支持该文件格式,因此将不再打开.在记事本中打开文件后,便会看到此文件.

As an example, I have a png file that will no longer open because the file format is not supported. Upon opening the file in notepad, I am presented with this.

version https://git-lfs.github.com/spec/v1
oid sha256:733c51c9ee6f0f395f5f042869307154d6ebf6d5d5e3bc10e2af68a432903bf0
size 5104

我的许多文件已被这些链接替换,而我访问这些文件的程序由于无法读取而抛出错误.

Many of my files are being replaced with these links and my programs that are accessing these files are throwing errors as they are unable to read them.

我在Windows 10中工作,已安装git lfs,并且在Windows Cmd行上使用git-bash.我相信当我安装git-bash时,我启用了符号链接,但不确定是否可能引起此问题.

I am working in Windows 10, I have git lfs installed, I am using git-bash on the Windows Cmd line. I believe that when I was installing git-bash, I enabled symbolic links, I am unsure if that could potentially be causing the issue.

如果您需要更多信息,请告诉我.我真的很感谢大家的帮助!

If you need more information, please let me know. I really appreciate everyone's help!

推荐答案

这些是Git LFS用于跟踪对象的指针文件.您看到它们的事实意味着未为您的存储库设置适当的过滤器.在结帐中运行git lfs install,以在存储库和~/.gitconfig中安装过滤器.

These are the pointer files that Git LFS uses to track objects. The fact that you're seeing them means that the proper filters for your repository aren't set up. Run git lfs install within your checkout to install the filters both in your repository and in your ~/.gitconfig.

完成此操作后,可以运行git lfs checkout来修复当前存储库,然后在签出分支时Git LFS应该可以正常工作.如果您修改或替换~/.gitconfig文件,请确保将git lfs install插入的过滤器条目保留在其中.

Once you've done that, you can run git lfs checkout to fix the current repository, and then Git LFS should work normally when you check out a branch. If you modify or replace your ~/.gitconfig file, be sure to keep the filter entries that git lfs install inserted there.

设置选项的正确命令如下:

The proper commands to set the options are as follows:

git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

不过,调用git lfs install要容易得多.

It's much easier to invoke git lfs install, though.

这篇关于GIt用LFS链接替换本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆