Changes after review.
This commit is contained in:
parent
1726ed1620
commit
2460e87199
|
@ -6,19 +6,22 @@ eleventyNavigation:
|
|||
order: 70
|
||||
---
|
||||
|
||||
Tracking huge files (files bigger than a few megabyte) with git can (over time) lead to a big repository size.
|
||||
Storing large (a few megabytes) binary files in Git is usually a bad idea.
|
||||
They are contained in the history forever, and thus blow up your repository size, annoys your contributors and costs Codeberg more storage.
|
||||
|
||||
The solution to this problem is to use [git-lfs][git-lfs].
|
||||
The files are still be tracked with git but the actual content is stored elsewhere on the Codeberg server side.
|
||||
But there is a good solution:
|
||||
Using [Git LFS (Large File Storage)][git-lfs], you can easily manage binary files, and remove them permanently when they are no longer necessary.
|
||||
|
||||
The files are still be tracked with Git but the actual content is stored elsewhere on the Codeberg server side.
|
||||
|
||||
## Installation
|
||||
|
||||
git-lfs is a command line plugin for git.
|
||||
git-lfs is a command line plugin for Git.
|
||||
|
||||
You can install it from the [git-lfs-Website][git-lfs] or via the package manager of your distribution.
|
||||
A more detailed installation description can be found at the [Installation article](https://github.com/git-lfs/git-lfs/wiki/Installation) of the git-lfs wiki.
|
||||
|
||||
After installation of the git-lfs plugin, it must be installed into your git configuration (the git config OS-user you want to use git-lfs with).
|
||||
After the installation of the git-lfs plugin, it needs to be enabled in your Git configuration.
|
||||
|
||||
This is achieved by calling:
|
||||
|
||||
|
@ -45,7 +48,7 @@ Be sure to add it to your repository as well.
|
|||
git add .gitattributes
|
||||
```
|
||||
|
||||
Now you can work with git as usual (and actually forget about the lfs stuff).
|
||||
Now you can work with Git as usual (and actually forget about the lfs stuff).
|
||||
git-lfs will transparently handle the use of lfs on the configured files for you.
|
||||
|
||||
## Which files are currently tracked?
|
||||
|
@ -73,8 +76,6 @@ $ git config lfs.https://codeberg.org/your-user-name/your-repository.git/info/lf
|
|||
|
||||
Locking ensures that the files you are trying to push not modified at the same time.
|
||||
|
||||
It also ensures that other users cannot modify the file at the same time.
|
||||
|
||||
Codeberg LFS supports locking and it is probably a good idea to activate it.
|
||||
Further details on the locking mechanism can be found in the git-lfs wiki article on [File Locking][git-lfs-locking].
|
||||
|
||||
|
@ -98,13 +99,13 @@ Use [git lfs migrate][git-lfs-migrate] to enable or disable the tracking of file
|
|||
All changes done by lfs-migrate are done in your local working copy.
|
||||
Nothing will be done on the server side unless you push your changes to the server.
|
||||
|
||||
**Note**: git lfs migrate will rewrite the history of your repository.
|
||||
**Note**: `git lfs migrate` will rewrite the history of your repository.
|
||||
So be sure that no one else is working with the repository during your changes.
|
||||
Also keep in mind, that all users must refresh their local repositories prior to doing changes to the altered repository.
|
||||
|
||||
### Enabling LFS in an existing repository
|
||||
|
||||
If you already have a file with a big file size in your repository, it will not automatically be moved to lfs by just enabling the tracking.
|
||||
If you already have **a big file ** in your repository, it will not automatically be moved to lfs by just enabling the tracking.
|
||||
|
||||
You can first run `git lfs migrate info` to see which files take up the most space in your repository. Add `--everything` to see the sizes of all files (even the smaller ones).
|
||||
|
||||
|
|
Loading…
Reference in a new issue