Created
July 28, 2020 12:19
-
-
Save marcus-nl/934264a83ca34b250c3558b69935b9b9 to your computer and use it in GitHub Desktop.
Bash index and pull git repositories in workspace
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
dir="$1" | |
repo=`cd $dir && git config --get remote.origin.url` | |
echo "$dir; $repo" |
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
# write list of directories containing .git to dirnames.txt | |
find -maxdepth 4 -type d -name .git | xargs dirname > dirnames.txt | |
# add the git origin and write to repos.csv | |
cat dirnames.txt | xargs -L 1 ./add_origin.sh > repos.csv |
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
while IFS="; " read dir url; do | |
echo "Cloning $url into $dir..." | |
git clone "$url" "$dir" | |
done <repos.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment