Skip to content

Instantly share code, notes, and snippets.

@BenMcLean
Last active May 27, 2022 15:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenMcLean/914452795ffc1cb2ea7664a21c65ce98 to your computer and use it in GitHub Desktop.
Save BenMcLean/914452795ffc1cb2ea7664a21c65ce98 to your computer and use it in GitHub Desktop.
Batch file to transfer a Git repository to a different remote repo
cd %~dp0
for %%g in ("%1") do set "Folder=%%~ng"
mkdir %Folder%
cd %Folder%
git clone --mirror %1
cd %Folder%.git
git config --unset core.bare
git remote remove origin
git remote add origin %2
git push -u origin --all
git push origin --tags
cd ../..
rmdir /s /q %Folder%
@PAUSE
cd %~dp0
for %%g in ("%1") do set "Folder=%%~ng"
mkdir %Folder%
cd %Folder%
git svn clone %1
cd %Folder%
git remote add origin %2
git push -u origin --all
git push origin --tags
cd ../..
rmdir /s /q %Folder%
@PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment