Codeberg Examples
July 19, 2026 · View on GitHub
Note: all command line arguments can be permanently set in your
$HOME/.config/ghorg/conf.yamlfor more information see the configuration section of the README.md.
To view all additional flags see the sample-conf.yaml or use ghorg clone --help. You can also read this page in your terminal with ghorg examples codeberg.
Quick Start
Clone every repo in a Codeberg org, using an Access Token
ghorg clone <codeberg_org> --scm=codeberg --token=XXXXXXX
Which will produce the following
$HOME/ghorg
└── codeberg_org
├── repo1
├── repo2
└── ...
Things to know
-
Codeberg runs Forgejo, which is API-compatible with Gitea. The
codebergscm reuses ghorg's Gitea backend and simply defaults the base URL tohttps://codeberg.org, so no--base-urlis required. Self-hosted Forgejo instances are also supported by setting--base-url. -
Create a token at https://codeberg.org/user/settings/applications with at least the
read:organizationandread:repositoryscopes. -
The
--tokenflag also accepts a path to a file containing the token e.g.--token=~/.config/ghorg/codeberg-token.txt. -
Running the same clone a second time will
git pullandgit cleanevery repo, overwriting local changes. If you work inside the clone directory use--no-cleanor--protect-local(see Don't miss these features). -
The
--preserve-scm-hostnameflag will always create a top level folder in your GHORG_ABSOLUTE_PATH_TO_CLONE_TO with the hostname of the instance you are cloning from (e.g.codeberg.org). -
Codeberg is a donation funded nonprofit; consider lowering
--concurrency(default 25) or adding--clone-delay-seconds=1when cloning large orgs from codeberg.org.
Examples
-
Clone an org
ghorg clone <codeberg_org> --scm=codeberg --token=XXXXXXX -
Clone a users repos
ghorg clone <codeberg_username> --scm=codeberg --clone-type=user --token=XXXXXXX -
Clone all repos from a codeberg org that are prefixed with "frontend" into a folder called "design_only"
ghorg clone <codeberg_org> --scm=codeberg --match-regex=^frontend --output-dir=design_only --token=XXXXXXXWill produce the following
/GHORG_ABSOLUTE_PATH_TO_CLONE_TO └── design_only ├── frontend-admin ├── frontend-dashboard └── frontend-website -
Clone an org, preserving the scm hostname, useful when you clone from several SCM providers
ghorg clone <codeberg_org> --scm=codeberg --token=XXXXXXX --preserve-scm-hostnameWill produce the following
/GHORG_ABSOLUTE_PATH_TO_CLONE_TO └── codeberg.org └── codeberg_org ├── repo1 └── repo2 -
Clone from a self-hosted Forgejo instance
ghorg clone <org> --scm=codeberg --base-url=https://forgejo.yourinstance.com --token=XXXXXXX -
Clone from a self-hosted Forgejo instance using HTTP (not recommended for production)
ghorg clone <org> --scm=codeberg --base-url=http://forgejo.yourinstance.com --token=XXXXXXX --insecure-codeberg-client
Don't Miss These Features
Cross provider flags that are easy to overlook — --dry-run, --protect-local, --prune, --backup, --clone-depth=1, --stats-enabled, ghorgignore/ghorgonly files, and more — are documented in one place in examples/features.md, or run ghorg examples features.