Last active
May 15, 2024 17:44
-
-
Save nigjo/6df33c85478d431210a431d4d570df72 to your computer and use it in GitHub Desktop.
backup your Github Repos and gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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" | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Allgemeinere Form für mehr Git-Server