Skip to content

GPG Signature never verifies if signing is done on Windows #34595

@ieris19

Description

@ieris19

Description

I have attempted several times to set up Git commit signing in both Linux and Windows. Linux is always a breeze, generate a key, setup git, commit with signature, passphrase and off-you-go. With Windows, it's always MASSIVE pain in the ass every time, and its never worked.

Never knew why either, until now. I have recently realized that my GPG signatures are different for the same content depending on the OS, which is a problem, because I believe that is the reason my git signatures work fine on Linux, but never on Windows, is because the servers are running Linux and are probably expecting the signature to be the same as the one it generates in Linux.

I am currently running Windows 11 and openSUSE Tumbleweed within WSL, but I have also verified with my Gitea server running Fedora. For the first two I am running gpg 2.5.6 with libgcrypt 1.11.1, Fedora is a bit behind at gpg 2.4.7 with libgcrypt 1.11.0-unknown as reported by the command:

$ gpg --version

I have followed GitHub's guide on how to generate a GPG key, using my Windows machine. Afterwards, I followed Red Hat's guide to migrate these keys onto other machines, in order to have the exact same key in every computer.

Uploading the key to Gitea promptly asks for confirmation, which is where the issue arises. Gitea offers a token and asks for a signature.

echo "[token]" | gpg -a --default-key [REDACTED] --detach-sig

Pasting this command into Windows, generates a signature that Gitea refuses with the following message:

The provided GPG key, signature and token do not match or token is out-of-date.

This has all been done on Windows so far, when I paste the command into either Linux environment that I imported the keys to, both times, the verification is simply accepted.

Unsurprisingly, committing from Windows doesn't verify the commits either

Gitea Version

1.23.7

Can you reproduce the bug on the Gitea demo site?

Yes

Git Version

git version 2.49.0

Operating System

Fedora Linux 42 (Workstation Edition)

How are you running Gitea?

I am running Gitea on bare metal from the executable provided at https://dl.gitea.com/gitea/
To be precise, https://dl.gitea.com/gitea/1.23.7/gitea-1.23.7-linux-amd64

I can also replicate the issue on https://demo.gitea.com

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions