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 "AUTOTITLE."
{% data reusables.large_files.resolving-upload-failures %}
{% ifversion ghes %}
{% 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 "AUTOTITLE."
{% endtip %}
{% endif %}
{% data reusables.command_line.open_the_multi_os_terminal %}
-
Change your current working directory to an existing repository you'd like to use with {% data variables.large_files.product_name_short %}.
-
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" > Tracking "*.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