Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bash script to pull git repositories, clone them, view log and grab the first email address seen.
# Set up a repos.txt file that contains a list of all the repos
# one repo per line. Then create an emails.txt file which is where
# all the emails will go. It'll be a CSV file so you can verify.
# This is a quick hacky way to get emails, not sure if I covered all
# valid characters in regex but didn't need precision. Feel free to
# make it better!
file="emails.txt" # Where emails go (CSV file)
while read p; do
echo "Working on $p"
git clone $p;
[[ $p =~ $reponame ]]
echo "Folder: $folder"
cd $folder
var=`git log`
[[ $var =~ $email ]]
cd ..
echo "Add ${BASH_REMATCH[1]} to emails.txt"
printf "$p, ${BASH_REMATCH[1]}\n" >> $file
rm -rf $folder
done < repos.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment