This error occurs when Git cannot write object files because your user account has exceeded its disk quota. The fix involves either freeing up space within your quota, requesting a quota increase from your system administrator, or cleaning up Git-specific storage like old objects and large files.
When Git stores data, it creates object files (blobs, trees, commits) in the `.git/objects` directory. Each object is stored as a file named by its SHA-1 hash. This error appears when the operating system refuses to create new files because your user account has exceeded its allocated disk quota. Disk quotas are limits imposed by system administrators on shared systems (university servers, web hosting, corporate networks) to prevent any single user from consuming all available disk space. Unlike "No space left on device" (which means the entire filesystem is full), "Disk quota exceeded" specifically means **your account's allocation is full**, even though the physical disk may have plenty of space remaining. This error commonly occurs during: - `git clone` of large repositories - `git fetch` or `git pull` with many new objects - `git commit` when adding large files - `git gc` (garbage collection) which may temporarily increase space usage before cleanup
First, determine how much quota you have and how much you're using:
# Standard quota command (Linux)
quota -s
# Or with more detail
quota -v
# On some systems
repquota -u $USERSample output:
Disk quotas for user alice (uid 1001):
Filesystem blocks quota limit grace files quota limit
/dev/sda1 4900M 5000M 5500M 15234 0 0This shows you're using 4900MB of a 5000MB soft limit. If blocks used exceeds your quota, that's the problem.
Identify what's using your quota:
# Find largest directories in home
du -sh ~/* 2>/dev/null | sort -hr | head -20
# Find large files
find ~ -type f -size +10M -exec ls -lh {} \; 2>/dev/null | sort -k5 -hr | head -20
# Check Git repository sizes
find ~ -name ".git" -type d -exec du -sh {} \; 2>/dev/null | sort -hrPay attention to:
- .git directories (each repository's Git data)
- node_modules, vendor, or dependency directories
- Log files, cache directories
- Downloaded archives or binaries
Run Git maintenance commands to reclaim space:
# Navigate to your repository
cd /path/to/repo
# Remove old reflog entries (keeps only recent history)
git reflog expire --expire=now --all
# Garbage collect unreachable objects
git gc --prune=now --aggressive
# Check the size before and after
du -sh .gitFor multiple repositories, run on all of them:
for repo in $(find ~ -name ".git" -type d); do
echo "Cleaning $repo"
git -C "$(dirname $repo)" gc --prune=now
doneFree up quota by removing files you don't need:
# Clear package manager caches
npm cache clean --force
pip cache purge
yarn cache clean
# Remove old log files
find ~ -name "*.log" -mtime +30 -delete
# Clear temporary files
rm -rf ~/.cache/* /tmp/$USER-*
# Remove unused node_modules (be careful!)
find ~ -name "node_modules" -type d -prune -exec rm -rf {} \;If you have repositories you no longer need, consider deleting them entirely or moving them to external storage.
If cloning a large repository exceeds your quota, use a shallow clone:
# Clone only the latest commit
git clone --depth 1 https://github.com/user/repo.git
# Clone with limited history
git clone --depth 100 https://github.com/user/repo.git
# Clone only a specific branch
git clone --depth 1 --single-branch --branch main https://github.com/user/repo.gitTo later get more history if needed:
# Deepen the history gradually
git fetch --deepen=100
# Or convert to full clone (if you have space)
git fetch --unshallowIf you legitimately need more space for development work, contact your system administrator:
Information to provide:
- Current quota and usage
- Why you need more space (specific repositories or projects)
- How much additional space you're requesting
Example request:
> I'm working on [project] which requires cloning [repository]. The repository is approximately 2GB. My current quota of 5GB is insufficient for this work along with my other projects. Could I request an increase to 10GB?
Alternative solutions they may suggest:
- Project-specific shared storage
- Temporary quota increase
- Moving large repositories to a different filesystem
If you have access to storage without quota limits, clone there instead:
# Check available filesystems
df -h
# Clone to a shared or project directory (if available)
git clone https://github.com/user/repo.git /shared/projects/repo
# Or use /tmp for temporary work (WARNING: may be cleared on reboot)
git clone https://github.com/user/repo.git /tmp/repoYou can create a symlink from your home directory:
ln -s /shared/projects/repo ~/repoFor CI/CD environments, configure the workspace to use a directory with sufficient space limits.
### Understanding Linux Disk Quotas
Linux supports two types of quotas:
- Block quota: Limits total disk space used (measured in 1KB blocks)
- Inode quota: Limits number of files/directories (each file uses one inode)
Git can hit either limitβblock quota from large files, or inode quota from many small object files.
# Check both block and inode usage
quota -vs### Soft vs Hard Limits
- Soft limit: Can be exceeded temporarily (grace period, usually 7 days)
- Hard limit: Absolute maximum, cannot be exceeded
When you're in the grace period after exceeding soft quota, you can still write files. Once the grace period expires or you hit the hard limit, all writes fail.
### Git Large File Storage (LFS)
If your repository contains large binary files, Git LFS can help by storing file contents on a remote server instead of in the local repository:
# Install Git LFS
git lfs install
# Track large file types
git lfs track "*.psd"
git lfs track "*.zip"
# Verify tracking
cat .gitattributesThis moves large file storage to the LFS server, reducing local disk usage.
### Repository Maintenance Best Practices
For constrained environments, regularly maintain repositories:
# Create a maintenance script
cat > ~/bin/git-cleanup.sh << 'EOF'
#!/bin/bash
for repo in $(find ~ -name ".git" -type d 2>/dev/null); do
dir=$(dirname "$repo")
echo "Cleaning $dir"
git -C "$dir" reflog expire --expire=now --all
git -C "$dir" gc --prune=now
done
EOF
chmod +x ~/bin/git-cleanup.shRun this weekly via cron to keep repositories compact.
### SSH Agent and Git Credential Issues
If you're using SSH keys stored on disk, ensure they're not unexpectedly large. Bloated ~/.ssh/known_hosts or many key files can contribute to quota usage:
# Check SSH directory size
du -sh ~/.ssh
# Remove old known_hosts entries
ssh-keygen -R old-server.example.com### CI/CD Pipeline Considerations
In CI environments with per-job disk limits:
# GitLab CI example - use shallow clones
variables:
GIT_DEPTH: 10
GIT_STRATEGY: fetch
# GitHub Actions - shallow checkout
- uses: actions/checkout@v4
with:
fetch-depth: 1### Checking Filesystem vs Quota
If you're unsure whether it's a quota issue or the disk is actually full:
# Check filesystem space (full disk)
df -h ~
# Check your quota (quota exceeded)
quota -sIf df shows space available but quota shows you're over limit, it's a quota issue. If df shows 100% used, the entire filesystem is full (a different problem).
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server
fatal: unable to access: Proxy auto-configuration failed
How to fix 'Proxy auto-configuration failed' in Git
fatal: unable to access: Authentication failed (proxy requires basic auth)
How to fix 'Authentication failed (proxy requires basic auth)' in Git
fatal: unable to access: no_proxy configuration not working
How to fix 'no_proxy configuration not working' in Git
fatal: unable to read tree object in treeless clone
How to fix 'unable to read tree object in treeless clone' in Git