| 1 | # Git Large File Storage |
| 2 | |
| 3 | [![CI status][ci_badge]][ci_url] |
| 4 | |
| 5 | [ci_badge]: https://github.com/git-lfs/git-lfs/workflows/CI/badge.svg |
| 6 | [ci_url]: https://github.com/git-lfs/git-lfs/actions?query=workflow%3ACI |
| 7 | |
| 8 | [Git LFS](https://git-lfs.github.com) is a command line extension and |
| 9 | [specification](docs/spec.md) for managing large files with Git. |
| 10 | |
| 11 | The client is written in Go, with pre-compiled binaries available for Mac, |
| 12 | Windows, Linux, and FreeBSD. Check out the [website](http://git-lfs.github.com) |
| 13 | for an overview of features. |
| 14 | |
| 15 | ## Getting Started |
| 16 | |
| 17 | ### Installing |
| 18 | |
| 19 | #### On Linux |
| 20 | |
| 21 | Debian and RPM packages are available from packagecloud, see the [Linux installation instructions](INSTALLING.md). |
| 22 | |
| 23 | #### On macOS |
| 24 | |
| 25 | [Homebrew](https://brew.sh) bottles are distributed and can be installed via `brew install git-lfs`. |
| 26 | |
| 27 | #### On Windows |
| 28 | |
| 29 | Git LFS is included in the distribution of [Git for Windows](https://gitforwindows.org/). |
| 30 | Alternatively, you can install a recent version of Git LFS from the [Chocolatey](https://chocolatey.org/) package manager. |
| 31 | |
| 32 | #### Using mise-en-place |
| 33 | |
| 34 | If you are using the [mise-en-place](https://github.com/jdx/mise) tool manager, Git LFS can be installed and made available in all of your project directories by running: |
| 35 | |
| 36 | ```ShellSession |
| 37 | $ mise use --global git-lfs@latest |
| 38 | ``` |
| 39 | |
| 40 | The `mise` utility supports Linux, macOS, and Windows, and provides various configuration options including system-wide settings for all users. See the project [documentation](https://mise.jdx.dev) for details on how to use this utility to manage your tools, environment variables, and also some tasks. |
| 41 | |
| 42 | #### From binary |
| 43 | |
| 44 | [Binary packages](https://github.com/git-lfs/git-lfs/releases) are |
| 45 | available for Linux, macOS, Windows, and FreeBSD. |
| 46 | The binary packages include a script which will: |
| 47 | |
| 48 | - Install Git LFS binaries onto the system `$PATH`. On Windows in particular, you may need to restart your command shell so any change to `$PATH` will take effect and Git can locate the Git LFS binary. |
| 49 | - Run `git lfs install` to perform required global configuration changes. |
| 50 | |
| 51 | ```ShellSession |
| 52 | $ ./install.sh |
| 53 | ``` |
| 54 | |
| 55 | Note that Debian and RPM packages are built for multiple Linux distributions and versions for both amd64 and i386. |
| 56 | For arm64, only Debian packages are built and only for recent versions due to the cost of building in emulation. |
| 57 | |
| 58 | #### From source |
| 59 | |
| 60 | - Ensure you have the latest version of Go, GNU make, and a standard Unix-compatible build environment installed. |
| 61 | - On Windows, install `goversioninfo` with `go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest`. |
| 62 | - Run `make`. |
| 63 | - Place the `git-lfs` binary, which can be found in `bin`, on your system’s executable `$PATH` or equivalent. |
| 64 | - Git LFS requires global configuration changes once per-machine. This can be done by |
| 65 | running: `git lfs install` |
| 66 | |
| 67 | #### Verifying releases |
| 68 | |
| 69 | Releases are signed with the OpenPGP key of one of the core team members. To |
| 70 | get these keys, you can run the following command, which will print them to |
| 71 | standard output: |
| 72 | |
| 73 | ```ShellSession |
| 74 | $ curl -L https://api.github.com/repos/git-lfs/git-lfs/tarball/core-gpg-keys | tar -Ozxf - |
| 75 | ``` |
| 76 | |
| 77 | Once you have the keys, you can download the `sha256sums.asc` file and verify |
| 78 | the file you want like so: |
| 79 | |
| 80 | ```ShellSession |
| 81 | $ gpg -d sha256sums.asc | grep git-lfs-linux-amd64-v2.10.0.tar.gz | shasum -a 256 -c |
| 82 | ``` |
| 83 | |
| 84 | For the convenience of distributors, we also provide a wider variety of signed |
| 85 | hashes in the `hashes.asc` file. Those hashes are in the tagged BSD format, but |
| 86 | can be verified with Perl's `shasum` or the GNU hash utilities, just like the |
| 87 | ones in `sha256sums.asc`. |
| 88 | |
| 89 | ## Example Usage |
| 90 | |
| 91 | To begin using Git LFS within a Git repository that is not already configured |
| 92 | for Git LFS, you can indicate which files you would like Git LFS to manage. |
| 93 | This can be done by running the following _from within a Git repository_: |
| 94 | |
| 95 | ```bash |
| 96 | $ git lfs track "*.psd" |
| 97 | ``` |
| 98 | |
| 99 | (Where `*.psd` is the pattern of filenames that you wish to track. You can read |
| 100 | more about this pattern syntax |
| 101 | [here](https://git-scm.com/docs/gitattributes)). |
| 102 | |
| 103 | > *Note:* the quotation marks surrounding the pattern are important to |
| 104 | > prevent the glob pattern from being expanded by the shell. |
| 105 | |
| 106 | After any invocation of `git-lfs-track(1)` or `git-lfs-untrack(1)`, you _must |
| 107 | commit changes to your `.gitattributes` file_. This can be done by running: |
| 108 | |
| 109 | ```bash |
| 110 | $ git add .gitattributes |
| 111 | $ git commit -m "track *.psd files using Git LFS" |
| 112 | ``` |
| 113 | |
| 114 | You can now interact with your Git repository as usual, and Git LFS will take |
| 115 | care of managing your large files. For example, changing a file named `my.psd` |
| 116 | (tracked above via `*.psd`): |
| 117 | |
| 118 | ```bash |
| 119 | $ git add my.psd |
| 120 | $ git commit -m "add psd" |
| 121 | ``` |
| 122 | |
| 123 | > _Tip:_ if you have large files already in your repository's history, `git lfs |
| 124 | > track` will _not_ track them retroactively. To migrate existing large files |
| 125 | > in your history to use Git LFS, use `git lfs migrate`. For example: |
| 126 | > |
| 127 | > ``` |
| 128 | > $ git lfs migrate import --include="*.psd" --everything |
| 129 | > ``` |
| 130 | > |
| 131 | > **Note that this will rewrite history and change all of the Git object IDs in your |
| 132 | > repository, just like the export version of this command.** |
| 133 | > |
| 134 | > For more information, read [`git-lfs-migrate(1)`](https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-migrate.adoc). |
| 135 | |
| 136 | You can confirm that Git LFS is managing your PSD file: |
| 137 | |
| 138 | ```bash |
| 139 | $ git lfs ls-files |
| 140 | 3c2f7aedfb * my.psd |
| 141 | ``` |
| 142 | |
| 143 | Once you've made your commits, push your files to the Git remote: |
| 144 | |
| 145 | ```bash |
| 146 | $ git push origin main |
| 147 | Uploading LFS objects: 100% (1/1), 810 B, 1.2 KB/s |
| 148 | # ... |
| 149 | To https://github.com/git-lfs/git-lfs-test |
| 150 | 67fcf6a..47b2002 main -> main |
| 151 | ``` |
| 152 | |
| 153 | ### Uninstalling |
| 154 | |
| 155 | If you've decided that Git LFS isn't right for you, you can convert your |
| 156 | repository back to a plain Git repository with `git lfs migrate` as well. For |
| 157 | example: |
| 158 | |
| 159 | ```ShellSession |
| 160 | $ git lfs migrate export --include="*.psd" --everything |
| 161 | ``` |
| 162 | |
| 163 | **Note that this will rewrite history and change all of the Git object IDs in your |
| 164 | repository, just like the import version of this command.** |
| 165 | |
| 166 | If there's some reason that things aren't working out for you, please let us |
| 167 | know in an issue, and we'll definitely try to help or get it fixed. |
| 168 | |
| 169 | ## Limitations |
| 170 | |
| 171 | Git LFS maintains a list of currently known limitations, which you can find and |
| 172 | edit [here](https://github.com/git-lfs/git-lfs/wiki/Limitations). |
| 173 | |
| 174 | Current releases of Git LFS will work with Git versions as early as |
| 175 | Git 2.0.0. However, for best performance, using a recent version of Git |
| 176 | is highly recommended. |
| 177 | |
| 178 | Git LFS source code utilizes Go modules in its build system, and therefore this |
| 179 | project contains a `go.mod` file with a defined Go module path. However, we |
| 180 | do not maintain a stable Go language API or ABI, as Git LFS is intended to be |
| 181 | used solely as a compiled binary utility. Please do not import the `git-lfs` |
| 182 | module into other Go code and do not rely on it as a source code dependency. |
| 183 | |
| 184 | ## Need Help? |
| 185 | |
| 186 | You can get help on specific commands directly: |
| 187 | |
| 188 | ```bash |
| 189 | $ git lfs help <subcommand> |
| 190 | ``` |
| 191 | |
| 192 | The [official documentation](docs) has command references and specifications for |
| 193 | the tool. There's also a [FAQ](https://github.com/git-lfs/git-lfs/blob/main/docs/man/git-lfs-faq.adoc) |
| 194 | shipped with Git LFS which answers some common questions. |
| 195 | |
| 196 | If you have a question on how to use Git LFS, aren't sure about something, or |
| 197 | are looking for input from others on tips about best practices or use cases, |
| 198 | feel free to |
| 199 | [start a discussion](https://github.com/git-lfs/git-lfs/discussions). |
| 200 | |
| 201 | You can always [open an issue](https://github.com/git-lfs/git-lfs/issues), and |
| 202 | one of the Core Team members will respond to you. Please be sure to include: |
| 203 | |
| 204 | 1. The output of `git lfs env`, which displays helpful information about your |
| 205 | Git repository useful in debugging. |
| 206 | 2. Any failed commands re-run with `GIT_TRACE=1` in the environment, which |
| 207 | displays additional information pertaining to why a command crashed. |
| 208 | |
| 209 | ## Contributing |
| 210 | |
| 211 | See [CONTRIBUTING.md](CONTRIBUTING.md) for info on working on Git LFS and |
| 212 | sending patches. Related projects are listed on the [Implementations wiki |
| 213 | page](https://github.com/git-lfs/git-lfs/wiki/Implementations). |
| 214 | |
| 215 | See also [SECURITY.md](SECURITY.md) for info on how to submit reports |
| 216 | of security vulnerabilities. |
| 217 | |
| 218 | ## Core Team |
| 219 | |
| 220 | These are the humans that form the Git LFS core team, which runs the project. |
| 221 | |
| 222 | In alphabetical order: |
| 223 | |
| 224 | | [@chrisd8088][chrisd8088-user] | [@larsxschneider][larsxschneider-user] | |
| 225 | | :---: | :---: | |
| 226 | | [![][chrisd8088-img]][chrisd8088-user] | [![][larsxschneider-img]][larsxschneider-user] | |
| 227 | | [PGP 088335A9][chrisd8088-pgp] | [PGP A5795889][larsxschneider-pgp] | |
| 228 | |
| 229 | [chrisd8088-img]: https://avatars1.githubusercontent.com/u/28857117?s=100&v=4 |
| 230 | [larsxschneider-img]: https://avatars1.githubusercontent.com/u/477434?s=100&v=4 |
| 231 | [chrisd8088-user]: https://github.com/chrisd8088 |
| 232 | [larsxschneider-user]: https://github.com/larsxschneider |
| 233 | [chrisd8088-pgp]: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x86cd3297749375bcf8206715f54fe648088335a9 |
| 234 | [larsxschneider-pgp]: https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xaa3b3450295830d2de6db90caba67be5a5795889 |
| 235 | |
| 236 | ### Alumni |
| 237 | |
| 238 | These are the humans that have in the past formed the Git LFS core team, or |
| 239 | have otherwise contributed a significant amount to the project. Git LFS would |
| 240 | not be possible without them. |
| 241 | |
| 242 | In alphabetical order: |
| 243 | |
| 244 | | [@andyneff][andyneff-user] | [@bk2204][bk2204-user] | [@PastelMobileSuit][PastelMobileSuit-user] | [@rubyist][rubyist-user] | [@sinbad][sinbad-user] | [@technoweenie][technoweenie-user] | [@ttaylorr][ttaylorr-user] | |
| 245 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | |
| 246 | | [![][andyneff-img]][andyneff-user] | [![][bk2204-img]][bk2204-user] | [![][PastelMobileSuit-img]][PastelMobileSuit-user] | [![][rubyist-img]][rubyist-user] | [![][sinbad-img]][sinbad-user] | [![][technoweenie-img]][technoweenie-user] | [![][ttaylorr-img]][ttaylorr-user] | |
| 247 | |
| 248 | [andyneff-img]: https://avatars1.githubusercontent.com/u/7596961?v=3&s=100 |
| 249 | [bk2204-img]: https://avatars1.githubusercontent.com/u/497054?s=100&v=4 |
| 250 | [PastelMobileSuit-img]: https://avatars2.githubusercontent.com/u/37254014?s=100&v=4 |
| 251 | [rubyist-img]: https://avatars1.githubusercontent.com/u/143?v=3&s=100 |
| 252 | [sinbad-img]: https://avatars1.githubusercontent.com/u/142735?v=3&s=100 |
| 253 | [technoweenie-img]: https://avatars3.githubusercontent.com/u/21?v=3&s=100 |
| 254 | [ttaylorr-img]: https://avatars2.githubusercontent.com/u/443245?s=100&v=4 |
| 255 | [andyneff-user]: https://github.com/andyneff |
| 256 | [bk2204-user]: https://github.com/bk2204 |
| 257 | [PastelMobileSuit-user]: https://github.com/PastelMobileSuit |
| 258 | [sinbad-user]: https://github.com/sinbad |
| 259 | [rubyist-user]: https://github.com/rubyist |
| 260 | [technoweenie-user]: https://github.com/technoweenie |
| 261 | [ttaylorr-user]: https://github.com/ttaylorr |