Skip to content

Instantly share code, notes, and snippets.

@zserghei
Created November 15, 2017 08:09
Show Gist options
  • Save zserghei/c44b604af0b4a6eaa047faeec1ea3026 to your computer and use it in GitHub Desktop.
Save zserghei/c44b604af0b4a6eaa047faeec1ea3026 to your computer and use it in GitHub Desktop.
Git clone multiple projects
#!/bin/bash
set -e # Exit immediately if a command exits with a non-zero status.
for rep in \
http://xxx@stash.example.com/project1.git \
http://xxx@stash.example.com/project2.git \
http://xxx@stash.example.com/project3.git \
; do
folder=`echo $rep | awk -F'/' '{print $NF}' | cut -d'.' -f1`
if [ ! -d $folder ]; then
echo " $folder"
git clone $rep
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment