Bulk clone GitHub repos for backup - Go version
- Single binary
- Optional authentication via a personal access token (PAT)
- Adjustable fork cloning (by default, forks are not cloned)
Go to the releases page and download a binary for your OS.
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
Run ghdump to see all commands:
ghdump
To clone repos of a user or an organization:
ghdump clone <username>
--token/-t- allows you to provide a token (PAT), necessary for cloning private repositories--output-dir/-o- the directory name where repos are cloned -dumpby default--visibility/-v- repo visibility (public,private,all) -allby default--clone-forks/-f- pass it to also clone repos forked by the user / organization
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
Always welcome!
If you want to contribute, please search through other issues first - if there are none that are applicable, create your own.
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.
Licensed under the GNU General Public License v3.0.