-
-
Save chrissainty/a6fe01e36483535bb673408ddd4bc853 to your computer and use it in GitHub Desktop.
Clone multiple repos with powershell
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
# import multiple remote git repositories to local Source dir | |
param ( | |
[string]$localFolder = "c:\Source\", | |
[array]$repos = @("myRepo", "repo1") | |
) | |
$repoLocation = "https://github.com/" | |
# for each repo found remotely, check if it exists locally | |
# if dir exists, skip, if not, clone the remote git repo into it | |
foreach ($gitRepo in $repos) { | |
If (Test-Path $localFolder\$gitRepo) { | |
echo "repo $gitRepo already exists" | |
} | |
Else { | |
echo "git clone $repoLocation$gitRepo $localFolder\$gitRepo" | |
git clone $repoLocation$gitRepo $localFolder\$gitRepo | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment