The forklone command clones a given GitHub repository — unless you don't
have push permission on the repository, in which case forklone forks it and
clones the fork instead so you get something you can push to.
forklone requires Python 3.8 or higher. Just use pip for Python 3 (You have pip, right?) to install it:
python3 -m pip install git+https://github.com/jwodder/forklone.git
forklone [<options>] <github-repo> [<directory>]
Clones the given GitHub repository to the given directory; if no directory is specified, the repository is cloned to a directory with the same name as the repository. If the authenticated user does not have push permission on the repository, then the repository is forked (or a pre-existing fork is used), and the fork is cloned instead.
The GitHub repository can be specified in the form OWNER/NAME (or, when
OWNER is the authenticated user, just NAME) or as a GitHub repository
URL.
If the cloned repository ends up being a fork (either because forklone
forked the specified repository or because the repository was already a fork),
then the clone's upstream remote is set to point to the fork's parent
repository.
| --clone-opts OPTIONS | |
Pass the given options to the Example: | |
| --org ORGANIZATION | |
| Create the fork within the given organization | |
| -U, --upstream-remote NAME | |
| Use the given name for the remote for the parent repository [default value: "upstream"] | |
forklone requires a GitHub access token with appropriate permissions in
order to run. Specify the token via the GH_TOKEN or GITHUB_TOKEN
environment variable (possibly in an .env file), by storing a token with
the gh or hub command, or by setting the hub.oauthtoken Git config
option in your ~/.gitconfig file.