Recently I needed to export all the source code from a Git repository into a Windows fileshare (and once there other operations would be performed.
Below is the PowerShell script I used to accomplish this for a repository on GitHub.
$GITEXE="C:\Program Files (x86)\Git\bin\git.exe"
$REPO="https://github.com/advancedrei/MetaWeblogPortable.git"
$DESTDIR="d:\SourceCodeExport"# Clean out destination folder
if (Test-Path $DESTDIR)
{
Remove-Item -Recurse -Force $DESTDIR
}# Clone from repo to folder
&$GITEXE clone --depth 1 $REPO $DESTDIR# Remove non-source code files from the destination folder
Remove-Item -Recurse -Force ( join-path $DESTDIR ".git")
As a follow-up, if you do this you may need to ZIP up the results. Check out my previous post explaining how to create ZIPs easily with PowerShell.