phase1: fix gitcheckout with corrupted .git
When the container running `git clone` is killed it will leave the .git
directory in unusable state which then leads in the following errors:
if [ -d .git ]; then git checkout -f master; git branch --set-upstream-to origin/master; else exit 0; fi
error: pathspec 'master' did not match any file(s) known to git.
fatal: branch 'master' does not exist
Fix it by removing .git completely if this happens, otherwise it might
simply leave shared build directory in the unusable state.
Signed-off-by: Petr Štetiar <ynezz@true.cz>