We had numerous incidents in the past where the repository wasn't buildable without the ".git" folder being available. This should be protected by nuking the .git folder away after fetching the repo (checkout) and passing in /p:DisableSourceLink (which is necessary as source link by default is only disabled locally, when not in CI).
More context in #47130.