Long File Names

While you should really aim to not have super long file names (>206 characters for entire file path), because concise names are much easier to work with and understand, if you have an unavoidably long file name, you may run into the following error while trying to commit a file:

While the ideal solution is to rename the file name to be shorter, it may be unavoidable if the path is long because you’re several folders deep.

In this case, go to GitHub Desktop, hit Repository -> Open in Command Prompt, this will open Command Prompt which will allow you to run manual Git commands. Type or right click and copy paste the following line:

git config --global core.longpaths true

this will allow git to process longer file path names. You should only need to do this once per computer.

Committing Large Files

GitHub has a file size limit of 100 MB per file. While most files should below this limit, zip files, database files, or other large GIS layers may exceed this limit and if you have other large files with many changes that could also slow down your repository. If you try to commit files over 100 MB you’ll get a warning that if you commit these files you’ll no longer be able to push to GitHub. In this case, you’ll need to take advantage of Git Large File Storage (LFS).

Git LFS essentially stores your large files in a separate spot on GitHub and just points to it in your main repository. You’ll still get these files when you or someone else clones your repository, it’ll just make copying and working with your repository faster.

Using Git LFS

You’ll need to set this up in each repository you want to use it. You will have to do this from the command line (or ask Katie to set it up in your repo). To get there, go to GitHub desktop -> repository -> open in command prompt.

This will open the command prompt where you can put git commands, with the working directory set to you git repository. Here type the following: git lfs install. This will set up git LFS in your repository.

Next you need to tell it which files you’d like git LFS to track, or handle. The easiest way to do this is by file extension. So if you have a few large PDF files in your repo you could track those by putting the following into the command line: git lfs track "*.pdf", here the “*” acts a wildcard so anything with a pdf extension will get tracked. You should repeat this with the extensions of any large files you have in your repo.

Once you’ve done this, you shouldn’t have to touch it again unless you have new file extensions, and your pushes and pulls should work seamlessly with GitHub desktop.

If someone is cloning the repository for the first time, they will get a notification like this on GitHub desktop:

If they initialize Git LFS, then they can easily clone all your files, including the ones managed by Git LFS, and push to the repository as normal.

Very Large Files

The only caveat to this is that if your files are larger than 2 GB, LFS will not work on GitHub. In this case, you should manually back up your files on Box. Within each node is a folder called 06_Projects-large-file-backup, make a new folder with your repository name and stick your files there. You should then add these files to your git.ignore file so it will not keep trying to track it with git. To do this go to GitHub desktop and right click the file and click “ignore file” (add to .gitignore).