theonedev/onedev · error · ExplicitException

Commit signature required, please generate system GPG signin

Error message

Commit signature required, please generate system GPG signing key first

What it means

When creating a commit through DefaultGitService with commit signing required (signRequired=true), the system looks up the GPG signing key configured in server settings. If no system signing key exists, the commit cannot be signed and an ExplicitException is thrown telling the admin to generate the system GPG signing key first.

Source

Thrown at server-core/src/main/java/io/onedev/server/git/service/DefaultGitService.java:845

						treeWalk.addTree(revTree);
					} else {
						revTree = null;
					}

					ObjectId treeId = insertTree(revTree, treeWalk, inserter, null,
							new HashSet<>(blobEdits.getOldPaths()),
							new HashMap<>(blobEdits.getNewBlobs()));

					if (treeId != null)
						commit.setTreeId(treeId);
					else
						commit.setTreeId(inserter.insert(new TreeFormatter()));

					PGPSecretKeyRing signingKey = settingService.getGpgSetting().getSigningKey();
					if (signingKey != null) {
						GitUtils.sign(commit, signingKey);
					} else if (signRequired) {
						throw new ExplicitException("Commit signature required, please generate "
								+ "system GPG signing key first");
					}

					ObjectId commitId = inserter.insert(commit);
					inserter.flush();
					RefUpdate ru = repository.updateRef(refName);
					ru.setRefLogIdent(authorAndCommitter);
					ru.setNewObjectId(commitId);
					ru.setExpectedOldObjectId(expectedOldCommitId);
					GitUtils.updateRef(ru);

					return commitId;
				} catch (RevisionSyntaxException | IOException e) {
					throw new RuntimeException(e);
				}
			}

		});

View on GitHub (pinned to d44925c47c)

Solutions

  1. Open Administration -> Server Setting and generate/import a system GPG signing key under the GPG section.
  2. Alternatively disable the 'commit signature required' setting if signing is not needed.
  3. After generating the key, retry the failed commit operation.
Defensive patterns

Strategy: fallback

Validate before calling

boolean signRequired = settingService.getSystemSetting().isCommitSignatureRequired();
boolean hasKey = settingService.getGpgSetting().getSigningKey() != null;
if (signRequired && !hasKey) throw new IllegalStateException("Enable commit signing or generate system GPG key in server settings");

Try / catch

try { commit(...); } catch (ExplicitException e) { if (e.getMessage().contains("GPG")) alertAdminToConfigureSigning(); throw e; }

Prevention

When it happens

Trigger: Any server-side commit creation (web edits, API commits) while the server's 'require commit signature' setting is enabled but Server Setting -> GPG has no signing key configured.

Common situations: Fresh OneDev instance where GPG signing enforcement was turned on before generating the system key; the signing key was deleted from GPG settings; migrating a server without copying the system GPG key.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/e7e4824e37abd2cb. Report an issue: GitHub.