# 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: ```sh 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: ```sh # Check what's shallow — if only ONE line, this works cat .git/shallow # Create graft making the shallow boundary a root commit echo " " > .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.