Removing .git after expansion seems fragile. Sandboxing the git step would close the whole class of bugs.