Skip to content
14 min read

fj repo

Work with repositories

fj repo [OPTIONS] <COMMAND>

Every command also accepts the global flags: --host, --debug, --no-pager, --json-fields.

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo list

List repositories you have access to on the current host

fj repo list [OPTIONS]

Options

  • -L, --limit <LIMIT> — Maximum number of repositories to fetch (default 30; results may be capped unless –paginate) [default: 30]
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --paginate — Fetch all pages instead of stopping at –limit
  • --page <PAGE> — Page of results to fetch [default: 1]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • -s, --search <SEARCH> — Search query (uses /repos/search)
  • --json — Emit raw JSON instead of a table

fj repo view

View a repository

fj repo view [OPTIONS] [REPO]

Arguments

  • [REPO] — owner/name slug. Inferred from the git remote when omitted

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --json — Emit JSON instead of a table
  • --web — Open the repo’s web page
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo clone

Clone a repository over git

fj repo clone [OPTIONS] <REPO> [DIR]

Arguments

  • <REPO> — owner/name slug
  • [DIR] — Optional destination directory

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo create

Create a new repository

fj repo create [OPTIONS] <REPO>

Arguments

  • <REPO> — [owner/]name. Without an owner, the authenticated user is used

Options

  • -d, --description <DESCRIPTION> — Repository description
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --private — Make the repository private
  • --init — Initialize with a commit
  • --clone — Clone the new repo into the current directory
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --web — Open the new repo in your browser

fj repo fork

Fork a repository

fj repo fork [OPTIONS] [REPO]

Arguments

  • [REPO] — Source repo owner/name. Inferred when omitted

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --org <ORG> — Place the fork under this organization instead of your user account
  • --name <NAME> — New repository name
  • --clone — Clone the fork after creation
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo sync

Sync a fork with its upstream default branch

fj repo sync [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --branch <BRANCH> — Branch to sync. Defaults to the repo’s default branch
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo edit

Edit a repository’s description, visibility, default branch

fj repo edit [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --description <DESCRIPTION> — Repository description
  • --website <WEBSITE> — Repository website URL
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --default-branch <DEFAULT_BRANCH> — Default branch name
  • --private <PRIVATE> — Force private/public. Accepts true or false [possible values: true, false]
  • --description-editor — Open $EDITOR for the description

fj repo rename

Rename a repository (in-place)

fj repo rename [OPTIONS] <REPO> <NEW_NAME>

Arguments

  • <REPO> — Repository as owner/name
  • <NEW_NAME> — New repository name

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo archive

Archive a repository (read-only)

fj repo archive [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo unarchive

Unarchive a repository

fj repo unarchive [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo delete

Delete a repository. Destructive

fj repo delete [OPTIONS] <REPO>

Arguments

  • <REPO> — Repository as owner/name

Options

  • -y, --yes — Skip the confirmation prompt
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo branches

List, create, or delete branches

fj repo branches [OPTIONS] [REPO] [COMMAND]

Arguments

  • [REPO] — Repository as owner/name

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --json — Emit JSON instead of a table

fj repo branches create

Create a branch

fj repo branches create [OPTIONS] <NAME>

Arguments

  • <NAME> — Branch name to create

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --from <FROM> — Source branch, tag, or SHA. Defaults to the server’s default branch
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo branches delete

Delete a branch

fj repo branches delete [OPTIONS] <NAME>

Arguments

  • <NAME> — Branch name to delete

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • -y, --yes — Skip the confirmation prompt
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo topics

Manage repo topics (tags)

fj repo topics [OPTIONS] [REPO] [COMMAND]

Arguments

  • [REPO] — Repository as owner/name

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --set <SET> — Replace the whole topic list (comma-separated) and print the list the forge confirms. Omit to just print. Use add / remove to change single topics

fj repo topics add

Add topics, keeping the ones already set, and print the confirmed list

fj repo topics add [OPTIONS] <TOPIC>...

Arguments

  • <TOPIC>... — Topics to add or remove

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo topics remove

Remove topics, keeping the rest, and print the confirmed list

fj repo topics remove [OPTIONS] <TOPIC>...

Arguments

  • <TOPIC>... — Topics to add or remove

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo mirror

Migrate or mirror a repo from another git host

fj repo mirror [OPTIONS] <SOURCE_URL>

Arguments

  • <SOURCE_URL> — Source URL (e.g. https://github.com/foo/bar.git)

Options

  • --dest <DEST> — Destination as [owner/]name. Defaults to the source’s basename under your user account
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --mirror — Migrate as a pull-mirror instead of a one-shot import
  • --private — Make the destination repo private
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --description <DESCRIPTION> — Description for the new repo
  • --auth-user <AUTH_USER> — Username for HTTP source-auth
  • --auth-pass <AUTH_PASS> — Password / token for HTTP source-auth
  • --service <SERVICE> — Service hint: git, github, gitea, gitlab, gogs [default: git]
  • --interval <INTERVAL> — Refresh interval for pull-mirrors (e.g. 8h, 1d)

fj repo mirror-sync

Manually trigger a sync on a pull-mirror

fj repo mirror-sync [OPTIONS] [REPO]

Arguments

  • [REPO] — Pull-mirror repository as owner/name (inferred from the git remote when omitted)

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repository arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo watch

Watch a repo (subscribe to its notifications)

fj repo watch [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo unwatch

Stop watching a repo

fj repo unwatch [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo star

Star a repo

fj repo star [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo unstar

Unstar a repo

fj repo unstar [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as owner/name

Options

  • -R, --repo <REPO_FLAG> — Alias for the positional repo arg
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo starred

List your starred repos

fj repo starred [OPTIONS]

Options

  • -L, --limit <LIMIT> — Maximum number of repositories to fetch [default: 30]
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --json — Emit JSON instead of a table
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo set-default

Pin which repo fj targets in this directory (like gh repo set-default)

fj repo set-default [OPTIONS] [REPO]

Arguments

  • [REPO] — Repository as <owner>/<name> to pin for this directory

Options

  • --view — Print the currently pinned default, if any
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --unset — Remove the pinned default
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo collaborator

Manage repository collaborators

fj repo collaborator [OPTIONS] <COMMAND>

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo collaborator list

List repository collaborators

fj repo collaborator list [OPTIONS]

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • -L, --limit <LIMIT> — Maximum number of collaborators to fetch [default: 30]
  • --json — Emit JSON instead of a table
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo collaborator add

Add or update a repository collaborator

fj repo collaborator add [OPTIONS] <USER>

Arguments

  • <USER> — Username to add or update

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --permission <PERMISSION> — Permission to grant [default: write][possible values: read, write, admin]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo collaborator remove

Remove a repository collaborator

fj repo collaborator remove [OPTIONS] <USER>

Arguments

  • <USER> — Username to remove

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo deploy-key

Manage repository deploy keys

fj repo deploy-key [OPTIONS] <COMMAND>

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo deploy-key list

List deploy keys on the repo

fj repo deploy-key list [OPTIONS]

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --json — Emit JSON instead of a table
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo deploy-key add

Add a deploy key (read-only by default)

fj repo deploy-key add [OPTIONS] <TITLE>

Arguments

  • <TITLE> — Key title

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --key <KEY> — Public key string. Use --from-file path (or - for stdin) instead for files
  • --from-file <FROM_FILE> — Read the key from a file (or - for stdin)
  • --allow-write — Allow the key to push (default is read-only)
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo deploy-key delete

Delete a deploy key by id

fj repo deploy-key delete [OPTIONS] <ID>

Arguments

  • <ID> — Deploy key id

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • -y, --yes — Skip the confirmation prompt
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo transfer

Request, review, accept, or reject a repository ownership transfer

fj repo transfer [OPTIONS] <COMMAND>

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo transfer request

Request a transfer to another owner, after reviewing who receives it.

Looks the new owner up on the forge first, says whether it is a user or an organization, who has to accept, and the access the request needs. Nothing is sent until you confirm. An unknown owner, or the current owner, is refused without sending anything. The result is reported as the forge returned it: moved, or pending acceptance.

fj repo transfer request [OPTIONS] <NEW_OWNER>

Arguments

  • <NEW_OWNER> — User or organization that should own the repository

fj repo transfer list

List pending transfers waiting on you or one of your organizations.

Forgejo has no endpoint that lists incoming transfers. A pending transfer only shows on the repository it applies to, so this reads every repository in one listing and keeps the ones marked pending: by default the repositories your account can access (which is where a repository offered to you appears), or with –owner the repositories of that user or organization that you can see. A repository offered to one of your organizations may be in neither listing unless you name its current owner with –owner. To check one repository directly, use fj repo transfer view -R <owner>/<name>.

fj repo transfer list [OPTIONS]

fj repo transfer view

Show the pending transfer on one repository, if any

fj repo transfer view [OPTIONS]

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --json — Emit JSON instead of text
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo transfer accept

Accept a pending transfer of a repository to you or your organization

fj repo transfer accept [OPTIONS]

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • -y, --yes — Skip the confirmation prompt
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo transfer reject

Reject a pending transfer of a repository to you or your organization

fj repo transfer reject [OPTIONS]

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • -y, --yes — Skip the confirmation prompt
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo commit

List and view commits, with their signature verification state

fj repo commit [OPTIONS] <COMMAND>

Options

  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo commit list

List commits on the default branch, or at a branch, tag, or SHA

fj repo commit list [OPTIONS]

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --ref <REF> — Branch, tag, or commit SHA to read at (the server resolves it)
  • --branch <NAME> — Read at this branch
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --tag <NAME> — Read at this tag. A tag is immutable, so this is always a read-only view
  • --path <PATH> — Only commits that touch this file or directory
  • -L, --limit <LIMIT> — Maximum number of commits to list [default: 30]
  • --json — Emit JSON instead of a table

fj repo commit view

View one commit: message, signature state, stats, and changed files

fj repo commit view [OPTIONS] <SHA>

Arguments

  • <SHA> — Commit SHA (full or abbreviated)

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --json — Emit JSON instead of text
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]

fj repo contents

Read a file or list a directory at a branch, tag, or commit

fj repo contents [OPTIONS] [PATH]

Arguments

  • [PATH] — File or directory path within the repo. Omit for the repo root

Options

  • -R, --repo <REPO> — Target repository as <owner>/<name>. Inferred from the git remote when omitted
  • --account <ACCOUNT> — Use an environment PAT for this account for this invocation only [env: FJ_ACCOUNT]
  • --ref <REF> — Branch, tag, or commit SHA to read at (the server resolves it)
  • --branch <NAME> — Read at this branch
  • --color <COLOR> — When to use ANSI color in output [default: auto][possible values: auto, always, never]
  • --tag <NAME> — Read at this tag. A tag is immutable, so this is always a read-only view
  • --json — Emit the API response as JSON instead of file text or a table
Contributors
  • Stephen Way