GPG Commit Signatures
Forgejo will verify GPG commit signatures in the provided tree by checking if the commits are signed by a key within the Forgejo database, or if the commit matches the default key for Git.
Keys are not checked to determine if they have expired or revoked. Keys are also not checked with keyservers.
A commit will be marked with an unlocked icon if no key can be found to verify it.
Automatic Signing
There are a number of places where Forgejo will generate commits itself:
- Repository Initialisation
- Wiki Changes
- CRUD actions using the editor or the API
- Merges from Pull Requests
Installing and generating a GPG key for Forgejo
Forgejo generates all its commits using the server git
command - and the gpg
command will be used for
signing.
General Configuration
Forgejo’s configuration for signing can be found with the
[repository.signing]
section of app.ini
:
SIGNING_KEY
There are three main options:
none
- this prevents Forgejo from signing any commitsdefault
- Forgejo will default to the key configured withingit config
KEYID
- Forgejo will sign commits with the GPG key with the IDKEYID
. In this case you should provide aSIGNING_NAME
andSIGNING_EMAIL
to be displayed for this key.
The default
option will interrogate git config
for
commit.gpgsign
option - if this is set, then it will use the results
of the user.signingkey
, user.name
and user.email
.
By default, Forgejo will look for the signing key in [git].HOME_PATH/.gnupg
.
However, this path differs from where GnuPG stores keys by default ($HOME/.gnupg
).
There are 2 possible solutions here:
- Move the
.gnupg
folder after importing/generating keys; - Set the
GNUPGHOME
environment variable to help Forgejo find the correct keychain.
INITIAL_COMMIT
This option determines whether Forgejo should sign the initial commit when creating a repository. The possible values are:
never
: Never signpubkey
: Only sign if the user has a public keytwofa
: Only sign if the user logs in with two factor authenticationalways
: Always sign
Options other than never
and always
can be combined as a comma
separated list. The commit will be signed if all selected options are true.
WIKI
This options determines if Forgejo should sign commits to the Wiki. The possible values are:
never
: Never signpubkey
: Only sign if the user has a public keytwofa
: Only sign if the user logs in with two-factor authenticationparentsigned
: Only sign if the parent commit is signed.always
: Always sign
Options other than never
and always
can be combined as a comma
separated list. The commit will be signed if all selected options are true.
CRUD_ACTIONS
This option determines if Forgejo should sign commits from the web editor or API CRUD actions. The possible values are:
never
: Never signpubkey
: Only sign if the user has a public keytwofa
: Only sign if the user logs in with two-factor authenticationparentsigned
: Only sign if the parent commit is signed.always
: Always sign
Options other than never
and always
can be combined as a comma
separated list. The change will be signed if all selected options are true.
MERGES
This option determines if Forgejo should sign merge commits from PRs. The possible options are:
never
: Never signpubkey
: Only sign if the user has a public keytwofa
: Only sign if the user logs in with two-factor authenticationbasesigned
: Only sign if the parent commit in the base repository is signed.headsigned
: Only sign if the head commit in the head branch is signed.commitssigned
: Only sign if all the commits in the head branch to the merge point are signed.approved
: Only sign approved merges to a protected branch.always
: Always sign
Options other than never
and always
can be combined as a comma
separated list. The merge will be signed if all selected options are true.
Obtaining the Public Key of the Signing Key
The public key used to sign Forgejo’s commits can be obtained from the API at:
In cases where there is a repository specific key this can be obtained from: