直到我做了以下事情

直到我做了以下事情

本文介绍了Git LFS拒绝正确跟踪我的大文件,直到我做了以下事情的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题



我尝试使用,尽管这里有很多关于SO的文章,关于Git和GitHub的文档以及我碰到过的一些Gists。



我的问题如下:

完成必要的步骤后:

  git lfs install 
git lfs track<感兴趣的文件>
git commit

我仍然没有任何文件被跟踪。如果我执行了

  git lfs ls-files 

它将是空白的。如果我继续前进&执行推送,交易将失败,说文件太大。 (正如所料,但我很绝望。)

解决方案

我的(原始海报)解决方案



然后,我发现了一些修复程序,其中一些修补程序似乎是个bug,其中有些修复程序对我来说根本不明显。


  1. 似乎为了将 lfs 现有存储库结合使用,黑客或第三方工具(如 BFG的转换器。


    • 我不想走这条路线,所以我只是在本地初始化一个新的存储库,然后做了重新挂钩的挑战真正的回购。

    • 我创建了一个新目录,然后 git init 等。


      • 在我的例子中,远程仓库是GitHub。所以我做了所有适当的连接,比如 git remote add origin [email protected]:< my_id> /< my_repo> .git

      • v = uLR1RNqJ1Mwrel =noreferrer> Git的培训视频声称,您可以简单地指定一个文件夹,例如my_folder /,我无法得到这个工作。因此,我只是巧妙地使用文件扩展名来管理事情。


        $ b

        • 例如, git lfs trackmy_folder /对我不起作用,但是 git lfs track* .zip确实有效。 b $ b
        • 我没有运气让LFS文件被正确识别,除非我有第一次更新 .gitattributes 文件,并提交并将该新文件推送到远程服务器




          • git lfs track* .zip

          • git add .gitattributes

          • git commit -m更新了属性

          • git push $ li $ $ c $ git add my_large_file.zip

          • git lfs ls-files


            • 在这里,我会确保我看到 my_large_file.zip 被跟踪。


          • git commit -m现在我添加大文件 / code>

          • git push







有些事情可能会起作用,而我只是在做错事。然而,遵循上述巫术最终让LFS工作,所以我认为我会把这些细节传递给其他人,以防其他人出现同样的问题。


Problem

I had troubles trying to use git LFS, despite the many suggestions here on SO, on Git and GitHub's documentation, and on some Gists I'd run across.

My problem was as follows:

After performing the necessary steps:

git lfs install
git lfs track "<file of interest>"
git commit

I would still not have any files being tracked. If I performed

git lfs ls-files

it would be blank. If I went ahead & performed the push, the transaction would fail, saying that the files are too large. (As expected, but I was desperate.)

解决方案

My (Original Poster) "Solution"

I then discovered a few fixes, some of which seem to be bugs, some of which simply were not obvious to me.

  1. It seems that in order to use lfs with an existing repository, a hack or third party tool such as BFG's converter is needed.

    • I did not want to go that route, so I simply initialized a new repository locally, then did the challenge of hooking it back up to the real repo.
    • I created a new directory, then git init, etc.
      • In my case, the remote repository was GitHub. So I did all those proper hookups like git remote add origin [email protected]:<my_id>/<my_repo>.git
  2. Also, while Git's Training Video claims that you can simply specify a folder, such as "my_folder/", I could not get this to work. Therefore, I just cleverly used filename extensions to manage things.

    • For example, git lfs track "my_folder/" would not work for me, but git lfs track "*.zip" did work.
  3. I had no luck getting LFS files to be identified correctly unless I had first updated the .gitattributes file, and committed and pushed that new file to the remote server.

    • git lfs track "*.zip"
    • git add .gitattributes
    • git commit -m "Updated the attributes"
    • git push
    • git add my_large_file.zip
    • git lfs ls-files
      • And here I would ensure that I saw my_large_file.zip being tracked.
    • git commit -m "Now I am adding the large file"
    • git push


It's possible that some of the things work, and I was simply doing them wrong. However, following the witchcraft described above finally got LFS to work, so I thought I'd pass on these details for others, in case someone else had the same problem.

这篇关于Git LFS拒绝正确跟踪我的大文件,直到我做了以下事情的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 16:19