Back to Codeberg

Authentication

forgejo-contrib-forgejo-cli-wiki-authentication.md

latest3.8 KB
Original Source

forgejo-contrib/forgejo-cli

Watch20

Star402

Fork

You've already forked forgejo-cli

51

CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity

Page: Authentication

Pages

ActionsAuthenticationBuildingHomeInstallationIssuesOrganizationsPRsRepositoriesUsers

HTTPS

No results

9 Authentication Cyborus edited this page 2026-04-16 14:54:41 -04:00

#Table of Contents

There are two ways to authenticate to a Forgejo instance: fj auth login and fj auth add-key

OAuth login

Select instances support OAuth authentication via fj auth login. It will open an authorization page in your browser. After accepting, you're all done and can return to your terminal. You're logged in!

The list of instances supported by this feature depends on your installation. By default, fj supports the following instances:

NameDomainSince Version
Codebergcodeberg.orgv0.1.0
Forgejocode.forgejo.orgv0.3.0
Forgejo (DEV){v7,v11,v12}.next.forgejo.orgv0.3.0
Forgejo (DEV){v13,v14}.next.forgejo.orgv0.4.0
Forgejo (DEV)v15.next.forgejo.orgv0.5.0
Disrootgit.disroot.orgv0.4.0
pub.solar gitgit.pub.solarv0.4.0
Kaki's gitgit.kaki87.netv0.4.0
git.gaygit.gayv0.4.0
Auxolotlgit.auxolotl.orgv0.4.0
Lix Systemsgit.lix.systemsv0.4.0
FFMPEGcode.ffmpeg.orgv0.4.0
Fedora Forgeforge.fedoraproject.orgv0.4.0
CodeFloecodefloe.comv0.5.0

Installing fj from your package manager may include more, but will likely include all of these.

You can locally add instances to this list after installation by including them in ~/.config/forgejo-cli/client_ids or /etc/fj/client_ids on Linux, or to %AppData%\forgejo-cli\config\client_ids on Windows.

Application key login

If the instance isn't supported with auth login, then Application Tokens are the alternative.

Navigate to https://[your-instance]/user/settings/applications, and generate a new application token. You may give it whatever permissions you like, but the more you do the more functionality fj will have. Once that token is generated, copy it and go back to your terminal. Run fj auth add-key and enter the token. You're logged in!

Instance URLs

If your current directory is a git repository with a remote on a Forgejo instance, it will try to log in on that instance. If not, or if you want to log in to a different instance, specify with the -H, --host flag. For example: fj -H codeberg.org auth login or fj --host codeberg.org auth add-key