Sign Commits
Use GPG or SSH keys to sign commits and verify authorship in Harness Code Repository.
Commit signing lets you cryptographically prove that you created a commit and that no one has tampered with it. When you sign a commit, Git attaches a digital signature using your private key, and anyone with your public key can verify that the commit is authentic.
Harness Code Repository supports commit signature verification for both GPG and SSH keys. After you add your public key to your Harness user profile, Harness Code verifies signatures on the commits you push and displays the verification status in the commit listing.
What you will learn
Commit signing: What commit signing is and why it matters for verifying authorship.
Git configuration: How to configure Git to sign commits with a GPG or an SSH key.
Verification status: How to read the verification badges on the Commits page.
Troubleshooting: How to resolve unverified and revoked signatures.
Before you begin
Repository access: You need push access to a Harness Code repository.
Key pair: You need a GPG or SSH key pair generated on your local machine. Go to Manage public keys to generate one.
Public key uploaded: Your public key must be present on your Harness user profile. Go to Manage public keys to add it.
Configure commit signing
Configure Git to sign your commits with either a GPG key or an SSH key. Use GPG if you already have a GPG key pair or prefer GPG for cryptographic signing. Use SSH if you already use SSH keys for authentication and want a setup without a separate GPG tool.
Step 1: Configure Git to use your GPG key
Find your GPG key ID:
In the output, find the sec line. The key ID follows the algorithm and key size. For example, in sec rsa4096/3AA5C34371567BD2, the key ID is 3AA5C34371567BD2.
Tell Git to use this key for signing, replacing 3AA5C34371567BD2 with your own key ID:
Step 2: Enable commit signing
To sign all commits by default:
Alternatively, sign individual commits by adding the -S flag:
Step 3: Push to Harness Code
Push your signed commits to your Harness Code repository as you normally would:
Harness Code verifies the signature against the GPG public keys on your user profile and displays the verification status on the commit listing page.
Step 1: Configure Git to use SSH for signing
Tell Git to use SSH as the signing format and specify the path to your SSH private key, replacing ~/.ssh/id_ed25519 with your own key path:
Step 2: Enable commit signing
To sign all commits by default:
Alternatively, sign individual commits by adding the -S flag:
Step 3: Push to Harness Code
Push your signed commits to your Harness Code repository:
Harness Code verifies the signature against the SSH public keys on your user profile and displays the verification status on the commit listing page.
Signature verification statuses
When you view commits on the Commits page in Harness Code, each signed commit displays a verification badge. Unsigned commits do not display a badge.
The badge indicates one of the following statuses:
Verified
The signature is valid and matches a public key on the committer's Harness user profile. This confirms that the stated author created the commit and that it has not been modified since it was signed.
Unverified
The commit has a signature, but Harness could not verify it. Typically the public key used to create the signature is not on the committer's Harness user profile, or the email address on the key does not match the committer's Harness account. The commit may be legitimate, but its authorship cannot be confirmed.
Revoked
The commit was signed with a key that has since been revoked. A revoked key means the key owner or an administrator explicitly invalidated the key, which can indicate that the key was compromised or is no longer trusted.
Troubleshooting
Next steps
You can now sign commits and confirm that Harness Code recognizes them as verified.
Manage public keys: Generate and add GPG or SSH keys to your Harness profile.
Commits: Create and inspect commits in Harness Code.
Enable security: Enforce committer email verification alongside signing.
Last updated
Was this helpful?