0

i like to write a oneliner which gets me all remote url from my cloned repositories underneath my git_repo folder (personal git root folder) and to pipe into a file my idea was something like

cat */.git/config | grep remote.origin.url= >> git_repos.txt

but of course this does not work.

  • Are you trying to match a particular line in your .git/config file? If so, which one and why doesn't your own suggestion work? (There's no "of course" here.) – roaima Jun 18 at 15:43
1

This will list all your remote URLs for remotes named “origin” in any git repositories beneath the current directory:

find . -path '*/.git/config' -execdir git remote get-url origin \;

It finds files named config inside a .git directory, and from every containing directory, runs git remote get-url origin which shows the remote URL for the “origin” remote in the current repository.

  • thanks that worked! – TheRojam Jun 24 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.