GitHub Font Hosting Guide
Master version control for fonts using Git and host them on GitHub Pages. Learn repository structure, release management, and best practices for font distribution.
TL;DR - Key Takeaways
- • Use Git LFS for large font files (TTF/OTF source files)
- • Host WOFF2 files on GitHub Pages for free CDN-like delivery
- • Tag releases with semantic versioning (v1.0.0, v1.1.0)
- • Include LICENSE file specifying font usage rights
In this article
GitHub provides an excellent platform for font version control and hosting. Whether you're managing custom brand fonts, maintaining open-source font projects, or simply need a reliable way to self-host fonts, GitHub offers the tools you need for professional font management.
This guide covers setting up font repositories with proper structure, using Git LFS for large files, hosting fonts via GitHub Pages, managing releases with semantic versioning, and automating font workflows with GitHub Actions.
The key advantage of GitHub hosting is complete control over your fonts combined with free, reliable delivery through GitHub Pages. You get version history, collaboration features, and integration with your existing development workflow.
Repository Structure
A well-organized font repository separates source files from distribution files.
Recommended Structure
company-fonts/
├── README.md
├── LICENSE
├── CHANGELOG.md
├── .gitattributes # Git LFS configuration
├── sources/ # Original font files (tracked with LFS)
│ ├── Inter-Regular.ttf
│ ├── Inter-Bold.ttf
│ └── Inter-Variable.ttf
├── fonts/ # Web-ready files (hosted on Pages)
│ ├── inter-400.woff2
│ ├── inter-700.woff2
│ └── inter-variable.woff2
├── css/
│ ├── inter.css # @font-face declarations
│ └── inter.min.css
├── docs/ # GitHub Pages source
│ ├── index.html
│ └── specimen.html
└── scripts/
└── build.sh # Conversion scriptssources/ Directory
Store original TTF/OTF files here. Track with Git LFS to avoid bloating repository size. These are the master files for regenerating web formats.
fonts/ Directory
Contains converted WOFF2 files ready for web use. These are the files actually loaded by websites and served via GitHub Pages.
Git LFS for Large Font Files
Font source files (TTF/OTF) can be large, especially variable fonts. Git LFS stores large files efficiently without bloating your repository history.
Setting Up Git LFS
# Install Git LFS brew install git-lfs # macOS apt install git-lfs # Ubuntu # Initialize in repository git lfs install # Track font source files git lfs track "*.ttf" git lfs track "*.otf" git lfs track "sources/*" # Commit .gitattributes git add .gitattributes git commit -m "Configure Git LFS for font files"
WOFF2 Files Don't Need LFS
WOFF2 files are already highly compressed and typically small (10-50KB). Track only the source TTF/OTF files with LFS, not the distribution WOFF2 files.
Hosting on GitHub Pages
GitHub Pages provides free hosting for your font files with HTTPS and decent performance.
Enable GitHub Pages
- Go to repository Settings → Pages
- Select source branch (main or gh-pages)
- Choose folder (/docs or /root)
- Save and wait for deployment
Your fonts will be available at:
https://username.github.io/company-fonts/fonts/inter-400.woff2
Using Fonts from GitHub Pages
@font-face {
font-family: 'Inter';
src: url('https://company.github.io/fonts/inter-400.woff2')
format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
}Custom Domain
Configure a custom domain (fonts.company.com) in GitHub Pages settings for branded URLs. Add a CNAME file to your docs folder with your custom domain.
Release Management
Use GitHub Releases to version your fonts and provide download archives.
Semantic Versioning for Fonts
Major (2.0.0)
Breaking changes: redesigned glyphs, removed weights, changed metrics
Minor (1.1.0)
New features: added weights, new character support, OpenType features
Patch (1.0.1)
Bug fixes: kerning fixes, glyph corrections, hinting improvements
Creating a Release
# Tag the release git tag -a v1.0.0 -m "Initial release" git push origin v1.0.0 # Or create via GitHub CLI gh release create v1.0.0 \ --title "v1.0.0 - Initial Release" \ --notes "First stable release of Inter font family" \ fonts/*.woff2 css/*.css
CORS on GitHub Pages
GitHub Pages serves files with permissive CORS headers, allowing fonts to be loaded from any domain.
Default CORS Headers
GitHub Pages includes these headers by default:
Access-Control-Allow-Origin: *
Fonts work cross-origin without configuration.
Cache Control Limitation
GitHub Pages sets a 10-minute cache. For longer caching, consider:
- Using a CDN in front of GitHub Pages
- Including version in filenames
- Deploying to dedicated hosting
Repository Documentation
Good documentation helps users implement your fonts correctly.
README.md Template
# Company Fonts Web-optimized font files for Company brand. ## Quick Start ```html <link rel="stylesheet" href="https://company.github.io/fonts/css/inter.css"> ``` ## Available Weights | Weight | File | Size | |--------|------|------| | 400 | inter-400.woff2 | 24KB | | 700 | inter-700.woff2 | 26KB | ## Self-Hosting Download from [Releases](./releases) or: ```bash npm install @company/fonts ``` ## License See [LICENSE](./LICENSE) for font licensing terms.
Prepare Fonts for GitHub Hosting
Convert your fonts to optimized WOFF2 format ready for GitHub Pages hosting.
Start Converting FontsWritten & Verified by
Sarah Mitchell
Product Designer, Font Specialist
GitHub Font Hosting FAQs
Common questions about hosting fonts on GitHub
