|
| 1 | +Remove Git LFS |
| 2 | +============== |
| 3 | + |
| 4 | +Services such as GitHub offer `Git LFS <https://git-lfs.com>`_ for their |
| 5 | +repositories, but these may not exceed the additional storage of 1 GiB. |
| 6 | +Purchasing additional quotas from GitHub is then quite expensive. |
| 7 | + |
| 8 | +.. seealso:: |
| 9 | + * `About storage and bandwidth usage |
| 10 | + <https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage>`_ |
| 11 | + |
| 12 | +But how do you get rid of Git LFS in such a repository? |
| 13 | + |
| 14 | +The following steps allow you to get rid of Git LFS: |
| 15 | + |
| 16 | +#. Use ``git lfs ls-files`` to get a list of all files managed by Git LFS. |
| 17 | +#. Next, we make sure that we have checked out all large files with
|
| 18 | + |
| 19 | + .. code-block:: console |
| 20 | +
|
| 21 | + $ git lfs fetch --all |
| 22 | + $ git lfs checkout |
| 23 | +
|
| 24 | +#. Remove the Git LFS filters: |
| 25 | + |
| 26 | + #. To do this, you must first remove entries such as ::samp:`*.{png} |
| 27 | + filter=lfs diff=lfs merge=lfs -text` from your :file:`.gitattributes` |
| 28 | + file. |
| 29 | + #. You can then stop Git tracking for each deleted entry in the |
| 30 | + :file:`.gitattributes` file, for example with :samp:`git lfs untrack |
| 31 | + '*.{png}'`.
|
| 32 | + |
| 33 | + Alternatively, you can also use ``cut -f 1 < .gitattributes | xargs "git |
| 34 | + lfs untrack {}"`` for all files managed with Git LFS. |
| 35 | + |
| 36 | + #. Finally, the line ends should be normalised with ``git add --renormalize |
| 37 | + .``. |
| 38 | + |
| 39 | +#. Now Git LFS can be uninstalled with ``git lfs uninstall``. |
| 40 | +#. Finally, the changes must be transferred to the server. |
| 41 | + |
| 42 | +Now you can switch to Manage data with :doc:`DVC <../../dvc/index>`, for |
| 43 | +example, to manage large files in a versioned manner. |
0 commit comments