docs/dev-tools/backends/forgejo.md
You may install Codeberg and other Forgejo compatible release assets directly using the forgejo backend. This backend downloads release assets from Forgejo repositories and is ideal for tools that distribute pre-built binaries through Forgejo releases.
By default, the Forgejo backend uses the public Codeberg instance at https://codeberg.org. For other or self-hosted Forgejo instances, you can specify a custom API URL using the api_url tool option.
The code for this is inside of the mise repository at src/backend/github.rs.
The following installs the latest version of a tool from Forgejo releases and sets it as the active version on PATH:
$ mise use -g forgejo:forgejo/runner[api_url=https://code.forgejo.org/api/v1,bin=forgejo-runner,bin=forgejo-runner]
$ forgejo-runner -v
forgejo-runner version v12.4.0
The version will be set in ~/.config/mise/config.toml with the following format:
[tools]
"forgejo:forgejo/runner" = {
version = "latest",
api_url = "https://code.forgejo.org/api/v1",
bin = "forgejo-runner",
}
For private repositories or higher API limits, mise supports several Forgejo token sources.
mise checks these sources in order and uses the first token found:
MISE_FORGEJO_ENTERPRISE_TOKEN (for non-codeberg.org hosts)MISE_FORGEJO_TOKENFORGEJO_TOKENcredential_command (if set)forgejo_tokens.toml (per host)fj CLI config (keys.json, if enabled)git credential fill (if forgejo.use_git_credentials=true)export MISE_FORGEJO_TOKEN="forgejo-token"
For self-hosted Forgejo instances:
export MISE_FORGEJO_ENTERPRISE_TOKEN="forgejo-enterprise-token"
forgejo_tokens.toml)# ~/.config/mise/forgejo_tokens.toml
[tokens."codeberg.org"]
token = "forgejo-public-token"
[tokens."forgejo.mycompany.com"]
token = "forgejo-enterprise-token"
credential_commandYou can provide a shell command that prints a token to stdout:
[settings.forgejo]
credential_command = "op read 'op://Private/Forgejo Token/credential'"
The target hostname is passed as $1 to the command.
fj CLI integrationmise can read tokens from the fj CLI (keys.json) as a fallback. It checks:
$XDG_DATA_HOME/forgejo-cli/keys.json (defaults to ~/.local/share/forgejo-cli/keys.json)~/Library/Application Support/Cyborus.forgejo-cli/keys.json (macOS)Disable this fallback with:
[settings.forgejo]
fj_cli_tokens = false
git credential fill fallbackAs a last resort, mise can query git credential helpers:
[settings.forgejo]
use_git_credentials = true
This uses git credential fill and supports credentials stored by helpers such as macOS Keychain.
Use mise token forgejo to see which token mise would use for a given host:
mise token forgejo
mise token forgejo --unmask
mise token forgejo forgejo.mycompany.com
The following tool-options are available for the forgejo backend—these
go in [tools] in mise.toml.
When no asset_pattern is specified, mise automatically selects the best asset for your platform. The system scores assets based on:
For most tools, you can simply install without specifying patterns:
mise install forgejo:user/repo
::: tip
The autodetection logic is implemented in src/backend/asset_matcher.rs, which is shared by the Forgejo, GitHub and GitLab backends.
:::
asset_patternSpecifies the pattern to match against release asset names. This is useful when there are multiple assets for your OS/arch combination or when you need to override autodetection.
[tools]
"forgejo:user/repo" = { version = "latest", asset_pattern = "tool_*_linux_x64.tar.gz" }
version_prefixSpecifies a custom version prefix for release tags. By default, mise handles the common v prefix (e.g., v1.0.0), but some repositories use different prefixes like release-, version-, or no prefix at all.
When version_prefix is configured, mise will:
[tools]
"forgejo:user/repo" = { version = "latest", version_prefix = "release-" }
Examples:
version_prefix = "release-":
1.0.0 → mise searches for release-1.0.0 tag1.0.0 (prefix stripped)version_prefix = "" (empty string):
1.0.0 → mise searches for 1.0.0 tag (no prefix)For different asset patterns per platform:
[tools."forgejo:user/repo"]
version = "latest"
[tools."forgejo:user/repo".platforms]
linux-x64 = { asset_pattern = "tool_*_linux_x64.tar.gz" }
macos-arm64 = { asset_pattern = "tool_*_macOS_arm64.tar.gz" }
checksumVerify the downloaded file with a checksum:
[tools."forgejo:owner/repo"]
version = "1.0.0"
asset_pattern = "tool-1.0.0-x64.tar.gz"
checksum = "sha256:a1b2c3d4e5f6789..."
Instead of specifying the checksum here, you can use mise.lock to manage checksums.
[tools."forgejo:user/repo"]
version = "latest"
[tools."forgejo:user/repo".platforms]
linux-x64 = {
asset_pattern = "tool_*_linux_x64.tar.gz",
checksum = "sha256:a1b2c3d4e5f6789...",
}
macos-arm64 = {
asset_pattern = "tool_*_macOS_arm64.tar.gz",
checksum = "sha256:b2c3d4e5f6789...",
}
sizeVerify the downloaded asset size:
[tools]
"forgejo:user/repo" = { version = "latest", size = "12345678" }
strip_componentsNumber of directory components to strip when extracting archives:
[tools]
"forgejo:user/repo" = { version = "latest", strip_components = 1 }
::: info
If strip_components is not explicitly set, mise will automatically detect when to apply strip_components = 1. This happens when the extracted archive contains exactly one directory at the root level and no files. This is common with tools like ripgrep that package their binaries in a versioned directory (e.g., mytool-14.1.0-x86_64-unknown-linux-musl/mytool). The auto-detection ensures the binary is placed directly in the install path where mise expects it.
:::
binRename the downloaded binary to a specific name. This is useful when downloading single binaries that have platform-specific names:
[tools."forgejo:user/repo"]
version = "2.29.1"
bin = "my-tool" # Rename the downloaded binary to my-tool
::: info
When downloading single binaries (not archives), mise automatically removes OS/arch suffixes from the filename. For example, docker-compose-linux-x86_64 becomes docker-compose automatically. Use the bin option only when you need a specific custom name.
:::
rename_exeRename the executable after extraction from an archive. This is useful when the archive contains a binary with a platform-specific name that you want to rename:
[tools."forgejo:user/repo"]
version = "latest"
asset_pattern = "tool_linux.zip"
rename_exe = "tool" # Rename the extracted binary to tool
::: tip
Use rename_exe for archives where the binary inside has a different name than desired. Use bin for single binary downloads (non-archives).
:::
bin_path::: v-pre
Specify the directory containing binaries within the extracted archive, or where to place the downloaded file. This supports Tera templating with variables like {{ version }}, {{ os }}, {{ arch }}, and arch aliases ({{ darwin_os }}, {{ amd64_arch }}, {{ x86_64_arch }}, {{ gnu_arch }}):
:::
[tools."forgejo:user/repo"]
version = "latest"
bin_path = "tool-{{ version }}/bin" # expands to tool-1.0.0/bin
Binary path lookup order:
bin_path is specified, use that directorybin_path is not set, look for a bin/ directory in the install pathbin/ directory exists, search subdirectories for bin/ directoriesbin/ directories are found, searches immediate subdirectories for any executable files. If an executable is found directly within a subdirectory, that entire subdirectory is considered a binary path.filter_binsComma-separated list of binaries to symlink into a filtered .mise-bins directory. This is useful when the tool comes with extra binaries that you do not want to expose on PATH.
[tools]
"forgejo:user/repo" = { version = "latest", filter_bins = "tool" }
When enabled:
.mise-bins subdirectory is created with symlinks only to the specified binariestool-helper or tool-server) are not exposed on PATHapi_urlFor other Forgejo compatible or self-hosted instances, specify the API URL:
[tools]
"forgejo:user/repo" = { version = "latest", api_url = "https://forgejo.mycompany.com/api/v1" }
If you are using a self-hosted Forgejo instance, set the api_url tool option and optionally the MISE_FORGEJO_ENTERPRISE_TOKEN environment variable for authentication:
export MISE_FORGEJO_ENTERPRISE_TOKEN="your-token"
forgejo:user/repoforgejo:user/[email protected]