Closed
Description
Feature Description
To make gitea sign commits generated by the app itself (merge commits, crud actions, repo init ...) users are required to correctly install a gpg signing key in the correct location. The relevant part in the documentation basically says: Go find out how to set that up yourself which has been a pain point for many users over the years and for myself as well.
Now that commit signing with SSH keys has been available for some time, would it be possible to use SSH keys for these commit signatures as well? Could be as simple as putting a private key in a specific .folder (maybe %(APP_DATA_PATH)/home/.ssh
) along with a "use ssh key for commit signing" setting under the [repository.signing]
section in the app.ini.
Thoughts?
Activity
brtwrst commentedon Apr 30, 2025
Ok so important update,

After reading this in the docs:
The default option will interrogate git config for commit.gpgsign option
I did some testing and found out, that you can already make gitea sign these commits with an SSH key and it's quite simple.
Issue is now that it will show the commit without a green lock in the interface when you view it:
I did confirm that this commit is signed by the SSH key I added though.
Here is what I did.
mkdir /data/gitea/home/.ssh
ssh-keygen
and create a keypair in/data/gitea/home/.ssh
chown -R 1000:1000 /data/gitea/home/.ssh
/data/gitea/home/.gitconfig
and add the following (add to section if it already exists):(not sure if SIGNING_NAME and SIGNING_EMAIL do anything in this case)
This will make gitea sign Merge/CRUD/init commit but sadly gitea will not accept it as a valid signign key and show the commits without a green lock symbol.
Is there a way already to tell gitea that this key should be "trusted" ?
ChristopherHX commentedon Apr 30, 2025
Add the ssh public key to an existing user?
brtwrst commentedon Apr 30, 2025
Yeah that might work but doesn't seem like the "correct way".
Should be some central list that contains the trusted keys.
The canonical place would be a allowed_signers file somewhere.
I tried creating an allowed signers file in the home folder with the key inside and added
to the .gitconfig file - but this changes nothing. Gitea seems not to be able to use this yet.
ChristopherHX commentedon Apr 30, 2025
Seems like this is more complicated.., I also try to figure out how this works.
The first time I used the wrong .gitconfig, my docker image had two of them...
ChristopherHX commentedon Apr 30, 2025
I checked the source code and debugger, this does only work correctly for a single user instance of Gitea. Very fragile.
ssh signed commit can only be verified if
git cat-file commit sha
is used to extract the signature and verify without git)With the setup you described 2. can not be satisfied for more than one user....,
so indeed we need changes to gitea. However not sure how to proceed.gitea/services/asymkey/commit.go
Line 363 in e67f74e
ChristopherHX commentedon Apr 30, 2025
I found how to resolve this part in Gitea 1.23
So I now have
Maybe collaboratorcommitter is better here, need to look around.
I don't think it is a problem to create a user called Gitea that has the signing key verified.
ChristopherHX commentedon Apr 30, 2025
looks good on my end now, thanks for pointing me to the correct git home.
brtwrst commentedon May 1, 2025
Nice find,
It still bugs me that I'd have to create a "dummy" user for this and also that the name of this user is not changeable.
Feels like a bad hack what we're doing here so for now I'll wait on some official Word from the maintainers on how they think this should work.
ChristopherHX commentedon May 1, 2025
It is changeable or do I miss something?, both username and email.
in /data/gitea/home/.gitconfig (of docker image)
Should be the following values for SIGNING_KEY = default without SIGNING_EMAIL and SIGNING_NAME (for default they are read from git config)
Yes you are correct, I didn't change both values.
I used a debugger and looking at the source code, IMHO this needs documentation
brtwrst commentedon May 1, 2025
Thanks for your time.
So this is barely usable and definitely needs documentation and/or some work done to make it easier and more robust.
I still think a solution which doesn't require the creation of another account would be a lot better.
Improve instance wide ssh commit signing (#34341)