Common issues and their solutions when working with dGit.

Installation Issues

Command Not Found

Problem:

-bash: dgit: command not found

Solution:

  1. Reinstall globally
npm uninstall -g dgit
npm install -g dgit

# Or update PATH if installed from source
export PATH="$PATH:$(npm bin -g)"
  1. Check npm global path:
npm config get prefix
# Add to PATH if needed
export PATH="$PATH:$(npm config get prefix)/bin"

Permission Errors

Problem:

npm ERR! Error: EACCES: permission denied

Solutions:

  1. Use sudo (not recommended):
sudo npm install -g dgit
  1. Fix npm permissions (recommended):
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config

Repository Issues

Invalid Repository

Problem:

Error: not a dgit repository

Solutions:

  1. Check current directory:
ls -la .dgit
  1. Initialize repository if needed:
dgit init
  1. Verify repository structure:
tree .dgit

Corrupt Repository

Problem:

Error: corrupt repository structure

Solutions:

  1. Check repository integrity:
# Verify database
ls -la .dgit/db

# Check objects
ls -la .dgit/objects
  1. Reinitialize if necessary:
mv .dgit .dgit_backup
dgit init

Storage Issues

Database Errors

Problem:

Error: Failed to access LevelDB database

Solutions:

  1. Check database lock:
rm .dgit/db/LOCK
  1. Verify permissions:
ls -la .dgit/db
chmod -R 755 .dgit/db
  1. Rebuild database:
# Backup first
cp -r .dgit/db .dgit/db_backup
rm -rf .dgit/db/*
dgit init

Disk Space Issues

Problem:

Error: no space left on device

Solutions:

  1. Check available space:
df -h .
  1. Clean unnecessary objects:
# Coming in future version
dgit gc

Commit Issues

Staging Failures

Problem:

Error: Failed to stage files

Solutions:

  1. Check file existence:
ls -la <file>
  1. Verify file permissions:
chmod 644 <file>
  1. Check index state:
cat .dgit/index

Commit Failures

Problem:

Error: Failed to create commit

Solutions:

  1. Verify staged changes:
# Future version
dgit status
  1. Check signing keys:
ls -la .dgit/keys
  1. Regenerate keys if needed:
rm .dgit/keys/*
dgit init

Performance Issues

Slow Operations

Problem: Commands taking too long to execute

Solutions:

  1. Check repository size:
du -sh .dgit
  1. Monitor system resources:
top
df -h
  1. Optimize storage:
# Coming in future version
dgit optimize

Debugging

Enable Debug Logging

# Set debug environment variable
export DEBUG=dgit:*

# Run command with debug output
dgit <command>

Check System Information

# Node.js version
node --version

# npm version
npm --version

# dGit version
dgit --version

Generate Debug Report

# Coming in future version
dgit debug-report

Common Error Messages

Error Code Message Solution
E001 Repository not found Run dgit init
E002 Invalid object hash Check file integrity
E003 Database access error Check permissions
E004 Commit signing failed Verify keys
E005 Storage full Free disk space

Getting Help

If you’re still experiencing issues:

  1. Check the GitHub Issues
  2. Search existing problems
  3. Create a new issue with:
    • Error message
    • Steps to reproduce
    • System information
    • Debug logs

Next Steps