Skip to content

karmek-k/ghdump

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ghdump

Bulk clone GitHub repos for backup - Go version

Features

Installation

Binaries

Go to the releases page and download a binary for your OS.

Building from source

Download the Go toolchain. Clone this repository with git and navigate to the resulting directory.

Download dependencies:

go mod download

And then build the binary:

go build

Usage

Run ghdump to see all commands:

ghdump

To clone repos of a user or an organization:

ghdump clone <username>

Available flags for clone

  • --token/-t - allows you to provide a token (PAT), necessary for cloning private repositories
  • --output-dir/-o - the directory name where repos are cloned - dump by default
  • --visibility/-v - repo visibility (public, private, all) - all by default
  • --clone-forks/-f - pass it to also clone repos forked by the user / organization

Examples

Clone user321's public repos

ghdump clone user321

Clone all user321's repos with a PAT

ghdump clone user321 -t PUT_TOKEN_HERE

Clone user321's private repos to /home/user/repos

ghdump clone user321 -t PUT_TOKEN_HERE -v private -o /home/user/repos

Contributing

Always welcome!

If you want to contribute, please search through other issues first - if there are none that are applicable, create your own.

Command scaffolding

I used cobra-cli to generate new commands.

In order to create one, download it:

go install github.com/spf13/cobra-cli@latest

And then run (for a new command called mynewcommand - change to your needs):

cobra-cli add mynewcommand

Delete comments at the top of the newly generated file.

License

Licensed under the GNU General Public License v3.0.