Created
August 18, 2014 19:33
-
-
Save Tantas/d49b09bbd29a40f06123 to your computer and use it in GitHub Desktop.
List the repository remotes found in a supplied directory
This file contains hidden or 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
#!/bin/sh | |
# List the repository remotes found in a supplied directory. | |
# List the available repositories if no argument | |
if [[ "$#" -ne 1 ]]; then | |
echo "Provide a directory containing repositories." | |
exit -1 | |
fi | |
# Find all files in the provided directory | |
# Check for the git remotes, do not display errors | |
# Remove every second line (push/pull) | |
# Print the second column | |
find $1 -depth 1 -exec git --git-dir={}/.git remote -v 2> /dev/null \; | awk 'NR%2==0' | awk '{print $2 }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment