-
-
Notifications
You must be signed in to change notification settings - Fork 0
Git LFS Client Setup
This page explains how to configure Git LFS clients to use your Anchor LFS server.
Install Git LFS if you haven't already:
# macOS
brew install git-lfs
# Ubuntu/Debian
sudo apt install git-lfs
# Windows (via Chocolatey)
choco install git-lfs
# Then initialise (once per user)
git lfs installThe recommended approach is to add an .lfsconfig file to your repository root. This ensures all contributors use the same LFS server:
[lfs]
url = https://lfs.example.com/org/repoCommit this file to your repository:
echo '[lfs]\n url = https://lfs.example.com/org/repo' > .lfsconfig
git add .lfsconfig
git commit -m "Configure LFS server"Alternatively, set the URL via Git config (this is local to your clone and not shared):
git config lfs.url https://lfs.example.com/org/repoTo set a default LFS server for all repositories:
git config --global lfs.url https://lfs.example.com/org/repoNote: The endpoint path in the URL (e.g., /org/repo) must match the endpoint value configured in your Anchor LFS config.toml.
When GitHub authentication is enabled on the endpoint, Git LFS needs credentials. The password should be a GitHub Personal Access Token (PAT).
Git LFS uses Git's credential system. The simplest setup:
# Store credentials (they will be saved by your credential helper)
git credential approve <<EOF
protocol=https
host=lfs.example.com
username=your-github-username
password=ghp_your_personal_access_token
EOFCreate or edit ~/.netrc (or ~/_netrc on Windows):
machine lfs.example.com
login your-github-username
password ghp_your_personal_access_token
Secure the file:
chmod 600 ~/.netrcGit LFS can pick up credentials from the GIT_ASKPASS program or credential helpers. Refer to the Git credential documentation for advanced setups.
Configure which files should be stored in LFS:
# Track by extension
git lfs track "*.psd"
git lfs track "*.zip"
git lfs track "*.bin"
# Track by path
git lfs track "assets/large/**"
# View tracked patterns
git lfs trackThis updates .gitattributes, which should be committed:
git add .gitattributes
git commit -m "Track large files with LFS"# Normal push; LFS objects are uploaded automatically
git push origin main# Normal pull; LFS objects are downloaded automatically
git pull
# Or fetch LFS objects explicitly
git lfs pull# Show LFS objects in the current checkout
git lfs ls-files
# Show LFS status
git lfs statusAnchor LFS supports the Git LFS file locking API:
# Lock a file before editing
git lfs lock assets/model.bin
# List current locks
git lfs locks
# Unlock when done
git lfs unlock assets/model.bin
# Force unlock (override someone else's lock)
git lfs unlock --force assets/model.binSee File Locking for more details.
Test that your client can reach the server:
# Check server health
curl https://lfs.example.com/health
# Test LFS environment
git lfs envThe git lfs env command shows the configured LFS endpoint and credential helper, which is useful for debugging.
- File Locking: Coordinate concurrent edits
- Authentication: Token setup and permissions
- Troubleshooting: Common client issues