DEV Community

Murahashi [Matt] Kenichi
Murahashi [Matt] Kenichi

Posted on • Updated on

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)