How to Remove the Library Folder from Your Unity Git Repository
Accidentally committed gigabytes of cache? Here's the safe, step-by-step way to clean it out without losing work.
A Unity project generates gigabytes of cache files that should never enter version control. Get a battle-tested .gitignore for Unity — copy it, download it, and understand every single rule inside it.
A .gitignore file tells Git which files and folders to leave out of your repository. For Unity, this is not optional — it is the difference between a clean, fast repo and a broken one.
Every time Unity opens a project, it rebuilds huge local caches like the Library and Temp folders. These files are machine-specific and can easily exceed several gigabytes. Committing them causes slow clones, endless merge conflicts, and repos that hit hosting size limits within weeks.
A proper Unity gitignore keeps only what defines your game — assets, packages, and settings — while everything Unity can rebuild stays out of Git.
Save this as a file named .gitignore in your Unity project's root folder — the same folder that contains Assets and ProjectSettings. Or just hit Download and drop the file in.
# ===== Unity generated folders (never commit) ===== [Ll]ibrary/ [Tt]emp/ [Oo]bj/ [Bb]uild/ [Bb]uilds/ [Ll]ogs/ [Uu]ser[Ss]ettings/ [Mm]emoryCaptures/ [Rr]ecordings/ # ===== Asset store tools & local packages cache ===== [Aa]ssets/AssetStoreTools* [Aa]ssets/Plugins/Editor/JetBrains* # ===== IDE & editor files ===== .vs/ .idea/ .vscode/ .consulo/ *.csproj *.sln *.suo *.user *.userprefs *.pidb *.booproj *.svd *.pdb *.mdb *.opendb *.VC.db # ===== OS junk files ===== .DS_Store .DS_Store? Thumbs.db ehthumbs.db Desktop.ini # ===== Unity crash reports & profiler ===== sysinfo.txt *.stackdump crashlytics-build.properties # ===== Builds & packages ===== *.apk *.aab *.unitypackage *.app # ===== Addressables & Gradle (safe to regenerate) ===== /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* /[Aa]ssets/[Ss]treamingAssets/aa.meta /[Aa]ssets/[Ss]treamingAssets/aa/* .gradle/ # ===== Never ignore these (keep them committed!) ===== # Assets/ -> your game content + .meta files # Packages/ -> manifest.json & packages-lock.json # ProjectSettings/ -> project configuration
Think of a Unity project as two halves: the part you create, and the part Unity generates. Commit the first, ignore the second.
Every asset in Unity gets a matching .meta file containing its unique ID and import settings. If these files go missing, every reference to that asset breaks for your entire team. Read our full guide: Unity .meta files explained.
In your project root (next to the Assets folder), create a file named exactly .gitignore — no extension. Paste the template from above, or use the Download button.
In Unity, go to Edit → Project Settings → Version Control and set Mode to Visible Meta Files. Then under Editor → Asset Serialization, choose Force Text.
Run git init, then git add . and git commit -m "Initial commit". Because the gitignore is already in place, Library and Temp never enter the repository.
Remove tracked folders without deleting them locally: git rm -r --cached Library, then commit. Full walkthrough: removing the Library folder from Git.
Textures, audio, video, and 3D models bloat Git history fast. Track heavy formats with LFS — see our complete Unity Git LFS setup guide.
The most damaging mistake. Missing meta files silently break asset references across the whole team. Meta files belong in Git, always.
Gitignore rules don't apply to files that are already tracked. If Library was committed once, remove it with git rm -r --cached.
These folders define how your project actually runs. Without them, teammates open a different game than you built.
Plain Git stores every version of every binary file forever. Set up LFS early — migrating later is painful.
One file. Forty rules. Gigabytes saved. Download the Unity gitignore and never commit the Library folder again.
Practical guides on Git, GitHub, LFS, merge conflicts, and keeping Unity projects clean — written for game developers, not sysadmins.
Accidentally committed gigabytes of cache? Here's the safe, step-by-step way to clean it out without losing work.
Textures, audio, and models don't belong in plain Git history. Set up Git LFS the right way in ten minutes.
Two people edited the same scene? UnityYAMLMerge can resolve it automatically. Here's how to enable it.
An honest comparison of Git and Unity's built-in DevOps version control — costs, workflows, and team size.
Feature branches, scene locking, and release flows that actually work when your files are binary-heavy.
From LFS migration to history rewriting — practical techniques to shrink a bloated Unity repo.
What's actually inside a .meta file, why Unity needs them, and the golden rules for keeping them safe in Git.
Never used GitHub before? This guide takes you from an empty repo to your first pushed Unity project.
It happens to almost everyone once: you create a Unity project, run git add . before adding a gitignore, and suddenly your repository contains a multi-gigabyte Library folder. Pushes take forever, your host complains about repo size, and teammates get merge conflicts in files nobody ever opened. Here's how to fix it cleanly.
A .gitignore file only prevents untracked files from being added. Once a file has been committed, Git keeps tracking it — even if you add an ignore rule afterwards. So the fix always has two parts: add the ignore rule, then tell Git to stop tracking the files it already knows about.
Before removing anything, make sure your project root has a complete Unity gitignore — you can download ours from the home page. Without this, the folder would just get re-added on your next commit.
The key command is git rm with the --cached flag, which removes files from Git's index but leaves them on your disk:
# untrack the generated folders, keep them locally
git rm -r --cached Library
git rm -r --cached Temp
git rm -r --cached Obj
git rm -r --cached Logs
Don't panic when the terminal prints hundreds of "rm" lines — nothing is being deleted from your computer. Git is only forgetting about the files.
git add .gitignore git commit -m "Remove generated folders from version control"
From this commit forward, the Library folder is invisible to Git. Teammates who pull this commit will see the folder disappear from tracking, but Unity will simply regenerate their local copy on next launch — that's expected and harmless.
The steps above stop future bloat, but the old Library files still live in your Git history, so clones remain heavy. If the repo is young, the easiest fix is starting a fresh repository. For established projects, tools like git filter-repo or BFG Repo-Cleaner can strip a folder from all past commits — coordinate with your whole team first, because this rewrites history and everyone must re-clone. We cover this in detail in 7 ways to reduce your Unity repo size.
Git was designed for source code — small text files that diff beautifully. Game projects are the opposite: full of textures, audio, video, and 3D models that Git stores as opaque blobs, keeping every version of every file forever. Git LFS (Large File Storage) solves this by storing big binaries outside your normal Git history, replacing them with tiny pointer files.
A simple rule: if your project contains more than a handful of files over ~10 MB, or your art content will be revised often, set up LFS before your first commit. Migrating an existing repo to LFS is possible, but doing it from day one is painless.
# Windows (with winget) winget install GitHub.GitLFS # macOS (with Homebrew) brew install git-lfs # then, once per machine: git lfs install
Run these from your project root. Each command adds a rule to a .gitattributes file:
# textures & images git lfs track "*.png" "*.jpg" "*.tga" "*.psd" "*.exr" # audio & video git lfs track "*.wav" "*.mp3" "*.ogg" "*.mp4" # 3D models & animation git lfs track "*.fbx" "*.obj" "*.blend" # misc binary git lfs track "*.ttf" "*.otf" "*.dll" "*.a"
git add .gitattributes git commit -m "Configure Git LFS tracking"
This file is the LFS equivalent of your gitignore — commit it and keep it at the repo root so every teammate uses the same rules automatically.
That's the beautiful part: from here, nothing changes in your daily workflow. git add, commit, and push behave exactly the same — LFS silently intercepts tracked file types and stores them efficiently.
lfs track, it stays in normal history. Use git lfs migrate import --include="*.png" to convert old commits (rewrites history — coordinate with your team).git lfs install.The most feared message in any Unity team: "CONFLICT (content): Merge conflict in Assets/Scenes/Main.unity". Scene and prefab files are YAML documents thousands of lines long, and hand-merging them is a nightmare. The good news: Unity ships with a dedicated merge tool — UnityYAMLMerge, also called Smart Merge — that resolves most scene conflicts automatically.
Smart Merge only works if your scenes are stored as text. In Unity, open Edit → Project Settings → Editor and set Asset Serialization Mode to Force Text. (New projects default to this, but verify it — binary scenes cannot be merged at all.)
Add this to your .gitconfig (global) or the repo's .git/config, adjusting the path to your Unity version:
[merge]
tool = unityyamlmerge
[mergetool "unityyamlmerge"]
trustExitCode = false
cmd = 'C:\\Program Files\\Unity\\Hub\\Editor\\<VERSION>\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
On macOS the tool lives inside the Unity app bundle at Unity.app/Contents/Tools/UnityYAMLMerge.
# after git pull / merge reports a conflict: git mergetool # then verify the scene opens correctly in Unity, and: git add Assets/Scenes/Main.unity git commit
UnityYAMLMerge understands the structure of scene files. If you moved a light and your teammate added a new enemy prefab, it merges both changes cleanly — something a line-based text merge would mangle.
If two people edit the same property of the same object (say, both move the same platform), no tool can guess who's right — it will fall back and ask you. That's why healthy Unity teams also use a simple social rule: one scene, one owner at a time. Break big levels into multiple additively-loaded scenes or prefabs so people rarely touch the same file. More on this in our branching strategy guide.
Unity offers its own version control system — Unity Version Control (formerly Plastic SCM) — as part of Unity DevOps. Meanwhile, Git remains the world's default. Which one fits your team? Here's an honest breakdown with no fanboying either way.
Unity Version Control's free tier is limited (a small number of users and storage); beyond that you pay per user per month plus storage. Git itself is free, though realistic Unity teams pay something for LFS storage on GitHub/GitLab or self-host. For programmer-heavy teams, Git usually ends up cheaper; for large art teams, UVC's pricing can be justified by saved friction.
Branching advice written for web developers doesn't survive contact with a game project. Unity repos are full of binary and semi-binary files that don't merge, which changes the math on long-lived branches. Here's a strategy that respects that reality.
The longer a branch lives, the more scenes and prefabs drift apart from main, and the uglier the eventual merge. So the golden rule for Unity teams: branch small, merge fast. A feature branch should live days, not weeks.
feature/enemy-ai, feature/main-menu-ui). Created from main, merged back within a few days.That's it. Avoid a permanent develop branch unless you have a dedicated build/QA process that demands it — every extra long-lived branch multiplies scene-merge pain.
Merge tools help, but the best conflict is the one that never happens. Break levels into multiple additively-loaded scenes, push shared objects into prefabs, and assign ownership so two people rarely edit the same file in parallel branches.
Keep feature branches current by rebasing onto main daily while the branch is private. Once a branch is shared or contains gnarly scene changes, prefer merge commits — rebasing shared history creates chaos.
A surprisingly effective habit: sync first thing, then work. It shrinks the window in which two people unknowingly edit the same asset.
Git has no native file locking, but Git LFS supports lockable files: mark scene files as lockable in .gitattributes and teammates can claim a lock with git lfs lock Assets/Scenes/Main.unity. It's opt-in discipline rather than enforcement, but for small teams it's usually enough.
Is your Unity repo measured in gigabytes, cloning slower every month? Repository bloat creeps in quietly and compounds. Here are seven fixes, ordered from easiest to most drastic.
Run git ls-files | head -50 and scan the output. If you see anything from Library/, Temp/, or *.csproj, your ignore rules came too late — untrack them with git rm -r --cached as shown in our Library-folder guide.
The single biggest win for most projects. New files: just set up tracking. Existing history: convert with git lfs migrate import --include="*.png,*.fbx,*.wav" --everything — this rewrites history, so the whole team must re-clone afterwards.
Don't guess — measure. This lists your largest objects in history:
git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sort -k3 -n -r | head -20
Found a 900 MB video someone committed in 2024 and deleted a week later? It still lives in history. git filter-repo --path path/to/file --invert-paths removes it from every commit. Again: history rewrite, team coordination required.
Old branches pin old objects in memory. Merge or delete branches that shipped months ago, then let your host run garbage collection (or run git gc --aggressive --prune=now on a self-hosted repo).
Raw footage, PSD masters with 50 layers, recorded gameplay videos, build outputs — do these need version control, or just storage? Cloud drives and asset servers are cheaper than Git history. Keep the repo for things that need versioning.
For a project early in development with hopeless history, sometimes honest triage wins: copy the working tree, create a new repo with a correct gitignore and LFS from day one, and archive the old repo read-only. One afternoon of pain, years of cleanliness.
Open any Unity project's Assets folder in a file explorer and you'll see a shadow: for every file and folder, a matching .meta file. New developers often see them as clutter — and ignoring or deleting them is the fastest way to break a shared project. Here's what they actually do.
Each .meta file is a small YAML document with two crucial jobs:
fileFormatVersion: 2 guid: 3f8a92b1c4d54e01a8b7f2e9d6c31a55 TextureImporter: ...compression, sRGB, sprite settings...
If a .meta file is missing when Unity opens the project, Unity generates a new one with a new GUID. Every reference pointing at the old GUID now points at nothing: prefabs show "Missing" scripts, scenes lose materials, and UI references go blank. On a team, this is how one bad commit silently corrupts everyone's project.
*.meta. (Our template doesn't.)Under Edit → Project Settings → Version Control, ensure Mode is set to Visible Meta Files. Hidden meta files can't be committed by Git at all, which guarantees breakage in any shared repo.
Never used Git or GitHub before? This guide assumes zero prior knowledge and takes you from a Unity project sitting on your desktop to a safely backed-up repository on GitHub. Total time: about fifteen minutes.
This is the step beginners skip, and it's the most important one. Before touching any Git command, put a proper Unity .gitignore in your project's root folder — the folder containing Assets. Download ours here. Doing this first means the giant Library folder never enters your repository at all.
Open a terminal (on Windows: right-click in the project folder → "Open in Terminal" or use Git Bash) and run:
git init git add . git commit -m "Initial commit"
init creates the repository, add . stages your files (the gitignore automatically excludes the junk), and commit saves the first snapshot.
my-first-game), choose Private unless you want the world to see it.GitHub shows you the commands after creating the repo. They look like this:
git remote add origin https://github.com/YOUR-USERNAME/my-first-game.git git branch -M main git push -u origin main
The first push may ask you to sign in to GitHub through your browser. When it finishes, refresh the GitHub page — your project is live. Notice there's no Library or Temp folder: your gitignore did its job.
From now on, saving your progress to GitHub is three commands:
git add . git commit -m "Describe what you changed" git push
Do this at the end of every work session. Each commit is a restore point you can return to — the closest thing game development has to a save file for the project itself.
Once you're comfortable, level up with Git LFS for large assets and, when you start working with others, our branching strategy for Unity teams.
Last updated: July 9, 2026
Your privacy matters to us. This Privacy Policy explains what information this website collects when you visit, how it is used, and the choices you have — in plain language.
This website is a static, informational site. We do not require accounts, logins, or personal details. Depending on hosting configuration, the following limited data may be collected automatically:
This site may use essential cookies (site functionality), analytics cookies (e.g., Google Analytics, to understand how visitors use the guide), and — if ads are displayed (e.g., Google AdSense) — advertising cookies from third-party vendors that may serve ads based on prior visits to this or other websites. You can control cookies in your browser settings and opt out of personalized ads at Google's Ads Settings page.
We may use Google Fonts (typefaces), Google Analytics (anonymous statistics), and Google AdSense (advertisements). Each operates under its own privacy policy.
The .gitignore download is generated entirely in your browser. No file is fetched from a server, no personal identifiers are attached, and nothing is installed on your device. It is a plain text file you can inspect in any editor.
Collected data is used only to operate the website, improve content, prevent abuse, and (where ads are enabled) support the site financially. We never sell personal data.
This is a technical resource for a general developer audience. We do not knowingly collect personal information from children under 13.
Depending on your location (e.g., GDPR), you may have rights to access, correct, or delete personal data. Since this site collects virtually no personal data, such requests usually concern our third-party providers — but you can always reach us via the Contact page.
We may update this policy; changes appear on this page with a new "Last updated" date.
Last updated: July 9, 2026
By accessing or using this website, you agree to these Terms & Conditions. If you do not agree with any part of them, please do not use the site.
This website is a free, informational resource about using .gitignore files with Unity projects. It is an independent educational project and is not affiliated with, endorsed by, or sponsored by Unity Technologies or the Git project.
You are welcome to read, share, and link to this guide freely, and to use the provided .gitignore template in any personal, educational, or commercial project — no attribution required. You may also modify the template. You may not republish the full written content of this guide as your own work, use the site for unlawful purposes, or attempt to disrupt it.
The template is provided free of charge, "as is", and without warranty of any kind. It is a plain text configuration file generated in your own browser. Review it before use — see our Disclaimer.
The written explanations, design, and original illustrations are the property of the site owner. "Unity" is a trademark of Unity Technologies; "Git" is a trademark of Software Freedom Conservancy — used here only descriptively under nominative fair use.
We are not responsible for third-party websites we link to. The site may display third-party advertisements to support its free content; an ad's presence is not an endorsement.
To the maximum extent permitted by law, the site owner is not liable for any direct, indirect, incidental, or consequential damages arising from use of the site or the template — including data loss or repository misconfiguration. You use all information and files at your own risk.
We may revise these terms at any time; updates take effect when posted. Questions? Use the Contact page.
Last updated: July 9, 2026
All content on this website — the guide, blog articles, illustrations, and the downloadable template — is provided for general educational and informational purposes only. We make no warranties about its completeness, accuracy, or suitability for your specific project.
Version control configuration affects your project's files. Before applying any gitignore rules, review them against your project structure, keep a backup, and test on a non-critical branch if unsure. Any action you take based on this website is strictly at your own risk; we are not liable for data loss, broken references, or repository issues.
This content does not constitute professional consulting. For complex production pipelines, consult your technical lead or a version-control specialist.
This is an independent community resource. We are not affiliated with, endorsed by, or sponsored by Unity Technologies, GitHub, GitLab, Bitbucket, or the Git project. Trademarks are used only to describe the subject matter.
The downloadable template is a plain text configuration file, not executable software. It contains no code that runs on your machine. You can and should open it in any text editor to verify its contents.
Unity and Git evolve; best practices change. If you spot something outdated, please tell us via the Contact page — we appreciate corrections.
Found an outdated rule? Have a suggestion for the template or a blog topic? We read every message and update the guide based on community feedback.
For questions, corrections, or partnership inquiries. We usually reply within 2–3 business days.
hello@example.comThink a rule is missing or outdated for a newer Unity version? Tell us the rule and why — community suggestions keep this template sharp.
Subject: "Template suggestion"