forgejo-contrib-forgejo-cli-wiki-authentication.md
Watch20
Star402
Fork
You've already forked forgejo-cli
CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity
Page: Authentication
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
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:
| Name | Domain | Since Version |
|---|---|---|
| Codeberg | codeberg.org | v0.1.0 |
| Forgejo | code.forgejo.org | v0.3.0 |
| Forgejo (DEV) | {v7,v11,v12}.next.forgejo.org | v0.3.0 |
| Forgejo (DEV) | {v13,v14}.next.forgejo.org | v0.4.0 |
| Forgejo (DEV) | v15.next.forgejo.org | v0.5.0 |
| Disroot | git.disroot.org | v0.4.0 |
| pub.solar git | git.pub.solar | v0.4.0 |
| Kaki's git | git.kaki87.net | v0.4.0 |
| git.gay | git.gay | v0.4.0 |
| Auxolotl | git.auxolotl.org | v0.4.0 |
| Lix Systems | git.lix.systems | v0.4.0 |
| FFMPEG | code.ffmpeg.org | v0.4.0 |
| Fedora Forge | forge.fedoraproject.org | v0.4.0 |
| CodeFloe | codefloe.com | v0.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.
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!
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