DEV Community

Cover image for Grab Your GitHub URLs Without Leaving The Command Line
Cary Miller
Cary Miller

Posted on

11 1

Grab Your GitHub URLs Without Leaving The Command Line

In keeping with my previous post about initializing, populating, and posting a repo to GitHub in just one step, I thought I'd share a quick one-liner bash alias I use for listing my GitHub urls on the command line.

alias ghrepos="curl -s -i -H 'Authorization: token $GHUB_TOKEN' \
    https://api.github.com/user/repos | grep -o 'https://github.com[^\"]*.git'"
Enter fullscreen mode Exit fullscreen mode

To use the above alias, you'll just need to replace $GHUB_TOKEN with your own Personal Access Token from GitHub.

There are many benefits to having this function at your fingertips—you can use it to quickly:

  • Navigate to a repo's url.
  • Clone a repo to your local machine.
  • Or just peruse your remote repos in one simple list, like this:
$ ghrepos

https://github.com/cmilr/Atom-Prefs.git
https://github.com/cmilr/Bash-Prefs.git
https://github.com/cmilr/Blender-Playground-v1.1.git
https://github.com/cmilr/Blender-Prefs.git
https://github.com/cmilr/CMillerCo-HTML.git
https://github.com/cmilr/CMillerCo-Rails.git
https://github.com/cmilr/DeadSimple-Blender-3D-Cheat-Sheet.git
https://github.com/cmilr/DeadSimple-Pixel-Perfect-Camera.git
https://github.com/cmilr/Git-Beautify-For-MacOS-Terminal.git
https://github.com/cmilr/HTML-Essential-Training.git
https://github.com/cmilr/iOS-Postprandial-Timer.git
https://github.com/cmilr/iOS-Programming-Big-Nerd-Ranch.git
https://github.com/cmilr/iOS-SwiftCalc.git
https://github.com/cmilr/Learning-iOS-App-Dev-1.git
https://github.com/cmilr/Learning-iOS-App-Dev-2.git
https://github.com/cmilr/Learning-iOS-App-Dev-3.git
https://github.com/cmilr/Unity2D-Components.git
https://github.com/cmilr/Unity3D_ImporterDefaults.git
https://github.com/cmilr/Visual-Studio-For-Mac-Dark-Syntax-HoneyBees.git
https://github.com/cmilr/VS-Prefs.git
https://github.com/cmilr/Xcode-Prefs.git
Enter fullscreen mode Exit fullscreen mode

I hope you find this as useful as I do.

Thanks for stopping by!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (2)

Collapse
 
danielma profile image
Daniel Ma •

Cool snippet! For tools like this, I usually use jq.

For example, you can accomplish the same goal with this snippet, treating the response as JSON instead of dealing with it as a blob of text.

curl -s -H 'Authorization: token $GHUB_TOKEN' \
    https://api.github.com/user/repos | jq -r '.[].clone_url'
Collapse
 
thatzacdavis profile image
Zachary Davis •

That's a really cool extension to this. Thanks for sharing!

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

đź‘‹ Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay