Skip to content

Instantly share code, notes, and snippets.

@nigjo
Last active May 15, 2024 17:44
Show Gist options
  • Save nigjo/6df33c85478d431210a431d4d570df72 to your computer and use it in GitHub Desktop.
Save nigjo/6df33c85478d431210a431d4d570df72 to your computer and use it in GitHub Desktop.
backup your Github Repos and gists
@echo off
setlocal
REM -- Skript-Action fuer die "Aufgabenplanung"
cd /D "%~dp0."
REM In der 'updateGithubMirrors.lst' stehen pro Zeile
REM <reposlistfile> <baseuri>
REM Beispiel:
REM repos.list https://github.com/mygithubname
REM gists.list https://gist.github.com
REM in der 'repos.list' stehen pro Zeile je
REM <basename> <remote-name>
REM
for /F "tokens=1*" %%R in (%~n0.lst) do call :backupAll %%R "%%S"
goto :eof
:backupAll
for /F "tokens=1*" %%G in (%1) do (
if exist "%~n1\%%G.git" (
pushd "%~n1\%%G.git"
cd
git fetch --all 2>&1
popd
) else (
if not exist %~n1 md %~n1
git clone --mirror "%~2/%%H.git" "%~n1\%%G.git"
)
)
@nigjo
Copy link
Author

nigjo commented May 15, 2024

Allgemeinere Form für mehr Git-Server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment