How to store GitHub LFS files on MEGA S4 using Anchorpoint
Editor’s note: This guest post was written by the team at Anchorpoint, a visual Git client built for artists and game developers.
Working with large binary files can quickly bloat your GitHub repositories and drive up storage and bandwidth costs. Git LFS (Git Large File Storage) helps keep your repo fast and manageable by storing large binaries externally while leaving only lightweight pointers in Git.
By combining GitHub with MEGA S4 for external LFS storage, and using Anchorpoint’s LFS-S3 transfer agent, you can offload heavy assets like textures, models, and media files to MEGA S4 while keeping your Git repo lean and affordable.
Why store your files with MEGA S4?
Save costs for your next game development project
Game development involves a lot of binary files, so using Git LFS is essential; if you don’t, you’ll quickly reach your repository limits.
A GitHub account comes with 10 GB of Git LFS storage and bandwidth per month. Exceeding these limits will cost you per GB per month for storage and bandwidth, which can really add up. And the larger the team working on the project, the more bandwidth will be consumed.
These kinds of costs are much higher than plans on MEGA, and they are hard to predict because they are billed per usage.
The solution: Light text files stored in your GitHub repository and heavy binary files stored in your MEGA S4 bucket.
Further benefits of storing large files externally
As well as cost savings, you won’t encounter any file limitations. Technically, Git LFS does not impose any file limitations. However, as the major Git hosting provider, GitHub imposes limitations of, for example, 2 GB or 4 GB per file, depending on your account type. While this might not be an issue for mobile game development, it will definitely limit you when working on larger projects involving the Unreal Engine.
Last but not least, you can use encryption methods to secure your binary files stored in your MEGA S4 bucket, thereby complying with higher security requirements.
Step 1 — Create a bucket and user on MEGA S4
Register for a MEGA Pro plan, enable S4 object storage, and create a user and a bucket. Don’t create folders in this bucket, this sometimes causes issues; leave it as is to hold LFS files.
Copy the ARN for the user you just created, we’ll use that shortly.
After creating the user and bucket, define the bucket policy for the user by going to the settings of your bucket, and clicking the Policy tab.
Add these lines to the policy:
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::2288480AAA55641:user/test-user"
},
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::ap-test",
"arn:aws:s3:::ap-test/*"
]
}
}And edit accordingly:
- Replace
ap-testwith the name of your bucket. - Replace
arn:aws:iam::2288480AAA55641:user/test-userwith the ARN you just copied.
Next, in the same window, click the Objects URL access tab and select Grant object URL access to bucket, then click Update.
Step 2 — Installing the Anchorpoint custom LFS-S3 agent
In order to send LFS files to MEGA S4, as well as pointers and text files to GitHub, you’ll need to use the Anchorpoint custom transfer agent, which is available from the GitHub page.
After downloading, place the file in a folder of your choice (ideally one dedicated to tools like this), then add that folder to your system’s PATH environment variable.
In Windows
- Rename the file from
lfs-s3-windows.exetolfs-s3.exe - Add it to your Windows path environment variable:
- In the Start menu, search for “environment” and click Edit the system environment variables.
- Click Environment Variables…
- Under the System variables heading, select the variable Path, and click Edit…
- Click New, then add a new variable in the format
C:\Folder\, whereCis the drive andFolderis the folder where you placedlfs-s3.exe. - Click OK.
In macOS
- Rename the file from
lfs-s3-mactolfs-s3 - Add it to your path environment variable:
- Open the Terminal.
- Run the following command:
sudo nano /etc/paths - If prompted, enter your password.
- Go to the bottom of the file, and enter the full path to the folder where you placed
lfs-s3, e.g./Users/you/tools - Press Control-X to quit.
- Press
Yto save the modified buffer.
To test it, simply type lfs-s3 --help from anywhere in GitBash or the command line. If it works, then the PATH environment variable was added correctly.
- If you get the error
lfs-s3 command not found: Running this could solve the issue:chmod +x /path/to/lfs-s3 - If you get an error about
PermissionorAccess Denied, you may have to unblock or allow access to the executable file. - In macoS this is Settings → Privacy & Security → “lfs-s3” was blocked to protect your Mac → Allow Anyway.
Step 3 — Using the repo with Anchorpoint
Anchorpoint is a Git-based version control solution designed for artists. It works with GitHub, is easy to learn, and has a global Git configuration, so you don’t need to configure Git for each user on your team.
Get MEGA’s stories in your inbox
Join Medium for free to get updates from this writer.
To use the agent with Anchorpoint, download the full repository, if you are using it for an existing project, from GitHub or wherever it is hosted.
Rename the .git folder to force Anchorpoint to initialise its own repo — this allows Anchorpoint to create a clean Git structure for the project.
Then, create a new project in Anchorpoint, and connect it to GitHub. Once the project is created, don’t commit any files until you’ve configured the transfer settings.
Transfer settings
- Go to Project Settings > Git and change the repository URL to lowercase if it contains uppercase letters, as the transfer agent requires a fully lowercase URL.
2. Go to Workspace Settings > Git > Edit Git Config. Add a key and a value for each line:
Parameter 1: lfs.customtransfer.lfs-s3.path
- Value:
lfs-s3
Parameter 2: lfs.customtransfer.lfs-s3.args
- Value:
--s3-bucket=megas3 --aws-s3-endpoint=https://s3.eu-central-2.s4.mega.io --aws-region=eu-central-2 --aws-access-key-id=AKIANAEHDQJWKS6AAAAAALLA6II3EUBNUBEKTDQ2Z6CZ --aws-secret-access-key=fasmSgsQdJmN3uKHAAAAAAFgFabfRRn3chV2w5xsN - Replace
megas3with the name of your bucket - You can replace the endpoint with one of your choice. For a list of all the endpoints, see the MEGA S4 settings. If you do, replace the
aws-regionwith the region from the endpoint you used. - Replace the Access key and Secret key with the ones you copied from MEGA S4.
Parameter 3: lfs.https://github.com/gneguceanu/mega3.git.standalonetransferagent
- Value:
lfs-s3 - Replace the URL with your new GitHub repository URL, ensuring it is all lowercase characters. Keep
.standalonetransferagentat the end.
Testing it out
After setting up the configuration, create a test commit with binary files, such as images and text files, to check if the agent is working properly. After pushing, check the files on GitHub and MEGA. On GitHub, the binary files should appear as pointers. On MEGA, only the LFS binary files will be present.
Once the entire project has been pushed and everything is working properly, invite your team members to the project. Since this is your workspace, they won’t have to set anything up. However, they will need to install the transfer agent, as mentioned in step 2 above.
Cloning the respository
Your collaborators may want to clone the repository too. Here’s how to do so:
- Clone the repo:
GIT_LFS_SKIP_SMUDGE=1 git clone <repo_url_here>. - Move to the cloned repo folder.
- Update the
.git/configfile to match the configuration we used when setting up lfs-s3 for the original repository. - Run
git lfs pull.
Using the repo with other Git clients
If you want to use the LFS-S3 agent with other Git clients, follow the steps below. Although this configuration was originally created for the GitHub Desktop Git client, it will work with all Git clients as long as the characters in the URL for GitHub repositories are all lowercase.
- After setting up the MEGA S4 bucket and installing the transfer agent as per step 2 above, create an empty repository on GitHub.
- Create a new empty folder and connect it to the repository on GitHub.
- In the URL section of the File > Clone Repository menu, enter your GitHub repository URL with lowercase letters.
- Once the empty repository is cloned, click Repository > Open in Command Prompt, or use the Ctrl+~ shortcut in GitHub Desktop.
- Download the installer for Git from https://git-scm.com/ and install it on your PC. The installer includes Git LFS.
— In the latest versions, Git LFS and Git Bash are selected by default when using the installer’s defaults. If you upgrade, uncheck “Only show new options” to see all available options and ensure that Git LFS and Git Bash are selected. - Select the binary files to manage with the following command, where .png and .fbx are the extensions of the files:
git lfs track "*.png" "*.fbx"
This command creates a.gitattributesfile listing all the file extensions handled by Git LFS and stored in your MEGA S4 bucket. - To avoid bloating your repository with temporary or library files, you’ll want to create a
.gitignorefile. - Open the
.gitdirectory in your project's root folder and use a text editor to edit theconfigfile. Add the following to the end of the file:
[lfs "customtransfer.lfs-s3"]
path = lfs-s3
args = --s3-bucket=megas3\
--aws-s3-endpoint=https://s3.eu-central-1.s4.mega.io --aws-region=eu-central-1\
--aws-access-key-id=AKIAG22MRK2KNKD3KCOF573QR67N4OCIMGG6UUGXFPC4\
--aws-secret-access-key=EyLc1R0F3cz6bisBnVAzbI8ILqCSnaLJYCeu4ANn
[lfs "https://github.com/gneguceanu/mega_test1.git"]
standalonetransferagent = lfs-s39. As before:
- Replace
megas3with the name of your bucket. - You can replace the endpoint with one of your choice. For a list of all the endpoints, see the MEGA S4 settings. If you do, replace the
aws-regionwith the region from the endpoint you used. - Replace the Access key and Secret key with the ones you copied from MEGA S4.
- Replace the URL with your new GitHub repository URL. If needed, replace uppercase characters with lowercase characters. Keep
standalonetransferagentat the end.
10. Copy your project files into the root folder of the new project and use GitHub Desktop to push the project to GitHub. Once the push is complete, check your files on GitHub and MEGA. On GitHub, the binary files should appear as pointers. On MEGA, only the LFS binary files will be present.
Wrapping up
This setup works for both newly created repositories and migrating existing ones — which takes a little bit more effort, but as you can see here, is still completely doable. Once the transfer agent is installed, it can be reused for other projects and works with any Git client.
Using GitHub, Anchorpoint, and MEGA S4 together gives you a reliable workflow for managing large files.
GitHub handles your source code, Anchorpoint provides an accessible workspace for artists and developers, and MEGA S4 takes care of storing large assets without the usual file size or bandwidth limitations. This avoids repository bloat and keeps storage and bandwidth costs predictable.
If you’re interested in using MEGA S4 as a backup for your projects, get in touch with us as we’d love to help.








