4.0 KiB
title, intro, redirect_from, versions, shortTitle
| title | intro | redirect_from | versions | shortTitle | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Configuring Git Large File Storage | Once [{% data variables.large_files.product_name_short %} is installed](/articles/installing-git-large-file-storage/), you need to associate it with a large file in your repository. |
|
|
Configure Git LFS |
If there are existing files in your repository that you'd like to use {% data variables.product.product_name %} with, you need to first remove them from the repository and then add them to {% data variables.large_files.product_name_short %} locally. For more information, see "Moving a file in your repository to {% data variables.large_files.product_name_short %}."
{% data reusables.large_files.resolving-upload-failures %}
{% ifversion ghes or ghae %}
{% tip %}
Note: Before trying to push a large file to {% data variables.product.product_name %}, make sure that you've enabled {% data variables.large_files.product_name_short %} on your enterprise. For more information, see "Configuring Git Large File Storage on GitHub Enterprise Server."
{% endtip %}
{% endif %}
{% data reusables.command_line.open_the_multi_os_terminal %}
2. Change your current working directory to an existing repository you'd like to use with {% data variables.large_files.product_name_short %}.
3. To associate a file type in your repository with {% data variables.large_files.product_name_short %}, enter git {% data variables.large_files.command_name %} track followed by the name of the file extension you want to automatically upload to {% data variables.large_files.product_name_short %}.
For example, to associate a .psd file, enter the following command:
$ git {% data variables.large_files.command_name %} track "*.psd"
> Adding path *.psd
Every file type you want to associate with {% data variables.large_files.product_name_short %} will need to be added with git {% data variables.large_files.command_name %} track. This command amends your repository's .gitattributes file and associates large files with {% data variables.large_files.product_name_short %}.
{% note %}
Note: We strongly suggest that you commit your local .gitattributes file into your repository.
- Relying on a global *.gitattributes* file associated with {% data variables.large_files.product_name_short %} may cause conflicts when contributing to other Git projects.
- Including the *.gitattributes* file in the repository allows people creating forks or fresh clones to more easily collaborate using {% data variables.large_files.product_name_short %}.
- Including the *.gitattributes* file in the repository allows {% data variables.large_files.product_name_short %} objects to optionally be included in ZIP file and tarball archives.
{% endnote %}
- Add a file to the repository matching the extension you've associated:
$ git add path/to/file.psd
- Commit the file and push it to {% data variables.product.product_name %}:
$ git commit -m "add file.psd"
$ git push
You should see some diagnostic information about your file upload:
> Sending file.psd
> 44.74 MB / 81.04 MB 55.21 % 14s
> 64.74 MB / 81.04 MB 79.21 % 3s
Further reading
- "Collaboration with {% data variables.large_files.product_name_long %}"{% ifversion fpt or ghec %}
- "Managing {% data variables.large_files.product_name_short %} objects in archives of your repository"{% endif %}