DEV Community

Murahashi [Matt] Kenichi
Murahashi [Matt] Kenichi

Posted on • Edited on

2 2

Git clone repositories in a GitHub organization

github-repos

TL;DR

Show git clone url in GitHub organization.

Usage

github-repos -search "org:packsaddle archived:false" -z | xargs -0 -P4 -I {} git clone {} --depth 1
Enter fullscreen mode Exit fullscreen mode

required: GITHUB_TOKEN=__YOUR_PERSONAL_TOKEN__

Motivation

There are several ways for cloning GitHub repositories in an organization.
How to clone all repositories in a Github Organization
Cloning All Repositories in a GitHub Organization - Scott's Weblog - The weblog of an IT pro focusing on cloud computing, Kubernetes, Linux, containers, and networking
Clone all repos from a GitHub organization

But I don't want to see my personal token for GitHub. And I want to handle pagination because my organization has over 400 repos 😅

I tried caarlos0/clone-org, but sometimes I got errors.

Repo

https://github.com/sanemat/go-githubrepos

Install

ghg

ghg get sanemat/go-githubrepos

go get

go get https://github.com/sanemat/go-githubrepos/cmd/github-repos

Updated: 2020-10-31

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay