Last active
September 27, 2023 15:21
-
-
Save xbalaji/41169f6c29bed31572aae0e4de861b6a to your computer and use it in GitHub Desktop.
oneliners-find.sh
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
# print all the fetch url's of repositories, this is assuming you are ~/dev/github-xbalaji or something like that | |
find . -mindepth 1 -maxdepth 1 -type d -exec bash -c 'cd {}; git config --get remote.origin.url' \; | sort -u | nl | |
# print all the fetch url's of repositories of any git repository | |
find . -name ".git" -exec bash -c 'cd {}; git config --get remote.origin.url' \; | |
# convert all http fetch urls to ssh as well | |
find . -name ".git" -exec bash -c 'cd {}; git config --get remote.origin.url' \; | sed -e 's,^https://github.com/,[email protected]:,g;s,.git$,,g' | sort -u > repo-list-all.txt | |
# create repo's | |
for repo in $(cat repo-list-all.txt); do git clone "${repo}"; done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment