Skip to content

Instantly share code, notes, and snippets.

@benkroeger
Created June 25, 2018 09:57
Show Gist options
  • Save benkroeger/54cadf6a9d5c9c34e3b703c50aed607d to your computer and use it in GitHub Desktop.
Save benkroeger/54cadf6a9d5c9c34e3b703c50aed607d to your computer and use it in GitHub Desktop.
Creates a list of all directories that are git repositories and (if available) print their remote `origin` url
#!/usr/bin/env bash
for D in *; do
if [ -d $D ]; then
cd $D
if [ -d .git ] || git rev-parse --git-dir > /dev/null 2>&1; then
echo "${D}: $(git remote get-url --push origin)"
fi
cd ..
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment