Skip to content

Instantly share code, notes, and snippets.

@xbalaji
Last active September 27, 2023 15:21
Show Gist options
  • Save xbalaji/41169f6c29bed31572aae0e4de861b6a to your computer and use it in GitHub Desktop.
Save xbalaji/41169f6c29bed31572aae0e4de861b6a to your computer and use it in GitHub Desktop.
oneliners-find.sh
# 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