layered-soul/skills/forgejo-operations/references/git-shallow-fixes.md
Hermes & Sam 5c5df32101 Populate layered-soul: identity, memories, skills, plan (Hermes & Sam)
- SOUL.md: full agent identity, operating principles, voice
- IDENTITY.md: runtime identity, hosts, boundaries
- USER.md: operator context imported from hermes-soul
- AGENTS.md: actual operating rules, infrastructure, quick reference
- memories/curated/: 5 topics (tailscale, forgejo, agents, projects, vaultwarden)
- skills/: 9 cross-harness skills imported from hermes-soul after review
- docs/PLAN-CONFIGURE-PRIVATE-REPO.md: configuration plan
- Validate: passes clean
2026-06-14 00:21:26 +02:00

1.2 KiB

Git Shallow Clone Fixes

Two patterns encountered during Forgejo migration when local clones were shallow and source remote was unreachable.

Pattern 1: Unshallow via HTTPS

When git fetch --unshallow over SSH hangs/times out (large repos, slow remote), switch to HTTPS temporarily:

git remote set-url origin https://codeberg.org/Owner/Repo.git
git fetch --unshallow origin
git remote set-url origin git@codeberg.org:Owner/Repo.git  # restore SSH

Pattern 2: Make first commit rootless (missing parent)

When .git/shallow lists a boundary commit whose parent doesn't exist locally, and the source remote is unreachable:

# Check what's shallow — if only ONE line, this works
cat .git/shallow

# Create graft making the shallow boundary a root commit
echo "<shallow-hash> " > .git/info/grafts

# Rewrite history to make it permanent
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch -f --msg-filter "cat" -- --all

# Clean up
rm .git/info/grafts .git/shallow

Warning: This rewrites all commit hashes. Only use when pushing to a fresh empty repo and no one depends on the old hashes. The repo should be small enough that filter-branch completes fast.