gpg signing not working for PR in organisition #10775

Closed
opened 2025-11-02 09:17:49 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @8mccm8 on GitHub (May 3, 2023).

Originally assigned to: @techknowlogick on GitHub.

Description

Hi,

  • I created an organization called team and a one repository ansible. I cloned this repo in my account jeanmichel and my goal is to signed the PR request into the origin repo team/ansible.git from mine for sure!

  • All, my personal commit are signed no issue BUT my PR are not signed.

  • During the process gitea can read the gpg key and tell me it will be signed:

  • but not and return an HTTP 500

2023/05/03 16:31:36 ...dules/git/command.go:255:Run() [D] /home/git/gitea/data/tmp/local-repo/pull.git1708653802: /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= commit --message=Merge pull request 'Mise à jour de 'README.md'' (#3) from jeanmichel/ansible:master into master
        Reviewed-on: http://server/git/team/ansible/pulls/3 -S1528 07CD 9411 4E1B 0419 644A 47D1 AA5F 58E0 79AF
2023/05/03 16:31:36 ...rvices/pull/merge.go:342:commitAndSignNoAuthor() [E] git commit PR[11]team/ansible#3[master...jeanmichel/ansible:master]: exit status 128
        error: gpg failed to sign the data
        fatal: failed to write commit object
2023/05/03 16:31:36 .../pull/merge_merge.go:21:doMergeStyleMerge() [E] PR[11]team/ansible#3[master...jeanmichel/ansible:master] Unable to make final commit: git commit PR[11]team/ansible#3[master...jeanmichel/ansible:master]: exit status 128
        error: gpg failed to sign the data
        fatal: failed to write commit object
2023/05/03 16:31:36 ...ers/web/repo/pull.go:1084:MergePullRequest() [E] Merge: git commit PR[11]team/ansible#3[master...jeanmichel/ansible:master]: exit status 128
        error: gpg failed to sign the data
        fatal: failed to write commit object
2023/05/03 16:31:36 ...s/context/context.go:218:HTML() [D] Template: status/500
2023/05/03 16:31:36 router: completed POST /team/ansible/pulls/3/merge for 10.130.120.16:0, 500 Internal Server Error in 84.4ms @ repo/pull.go:919(repo.MergePullRequest)
  • here the sample on my app.ini
[repository.signing]
SIGNING_KEY         = 152807CD94114E1B0419644A47D1AA5F58E079AF
SIGNING_NAME        = team
SIGNING_EMAIL       = team@email.com
INITIAL_COMMIT      = always
CRUD_ACTIONS        = pubkey, parentsigned
WIKI                = never
MERGES              = always
DEFAULT_TRUST_MODEL = committer
  • GPG looks good:
$ gpg --fingerprint team@email.com
pub   rsa2048 2023-05-03 [SC]
      152807CD94114E1B0419644A47D1AA5F58E079AF
uid          [  ultime ] team (Gitea Keys) <team@email.com>
sub   rsa2048 2023-05-03 [E]
  • and the gitconfig file:

$ cd /home/git/gitea/data/home
$ cat .gitconfig
[user]
        name = team
        email = team@email.com
[core]
        quotePath = false
        logAllRefUpdates = true
        commitGraph = true
[gc]
        reflogExpire = 90
        writeCommitGraph = true
[receive]
        advertisePushOptions = true
        procReceiveRefs = refs/for
[fetch]
        writeCommitGraph = true
[safe]
        directory = *
[uploadpack]
        allowfilter = true
        allowAnySHA1InWant = true

I tried also with:

& git config --global user.signingkey 152807CD94114E1B0419644A47D1AA5F58E079AF
$ git config --global user.name team
$ git config --global user.email team@email.fr

config added in

$ cat /home/git/.gitconfig
[user]
        signingkey = 152807CD94114E1B0419644A47D1AA5F58E079AF
        name = team
        email = team@email.fr

I'm pretty sure I missed something but I tried different configuration all gpg in gitconfig but always the same issue...

thanks for your feed back

thx for @techknowlogick discord support

Gitea Version

1.19.0 and 1.19.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.31.1

Operating System

Red Hat Enterprise Linux release 8.7 (Ootpa)

How are you running Gitea?

simple systemd start
fresh install and all repo are created with migration tool from 1.14.0, no package,
and debuging in consol

GITEA_WORK_DIR=/home/git/gitea /usr/local/bin/gitea web -c /etc/gitea/app.ini -p 3001

Database

MySQL

Originally created by @8mccm8 on GitHub (May 3, 2023). Originally assigned to: @techknowlogick on GitHub. ### Description Hi, - I created an organization called **team** and a one repository **ansible**. I cloned this repo in my account **jeanmichel** and my goal is to signed the **PR** request into the origin repo **team/ansible.git** from mine for sure! - All, my personal commit are **signed** no issue BUT my **PR** are not signed. - During the process **gitea** can read the gpg key and tell me it will be signed: - but **not** and return an **HTTP 500** ``` 2023/05/03 16:31:36 ...dules/git/command.go:255:Run() [D] /home/git/gitea/data/tmp/local-repo/pull.git1708653802: /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= commit --message=Merge pull request 'Mise à jour de 'README.md'' (#3) from jeanmichel/ansible:master into master Reviewed-on: http://server/git/team/ansible/pulls/3 -S1528 07CD 9411 4E1B 0419 644A 47D1 AA5F 58E0 79AF 2023/05/03 16:31:36 ...rvices/pull/merge.go:342:commitAndSignNoAuthor() [E] git commit PR[11]team/ansible#3[master...jeanmichel/ansible:master]: exit status 128 error: gpg failed to sign the data fatal: failed to write commit object 2023/05/03 16:31:36 .../pull/merge_merge.go:21:doMergeStyleMerge() [E] PR[11]team/ansible#3[master...jeanmichel/ansible:master] Unable to make final commit: git commit PR[11]team/ansible#3[master...jeanmichel/ansible:master]: exit status 128 error: gpg failed to sign the data fatal: failed to write commit object 2023/05/03 16:31:36 ...ers/web/repo/pull.go:1084:MergePullRequest() [E] Merge: git commit PR[11]team/ansible#3[master...jeanmichel/ansible:master]: exit status 128 error: gpg failed to sign the data fatal: failed to write commit object 2023/05/03 16:31:36 ...s/context/context.go:218:HTML() [D] Template: status/500 2023/05/03 16:31:36 router: completed POST /team/ansible/pulls/3/merge for 10.130.120.16:0, 500 Internal Server Error in 84.4ms @ repo/pull.go:919(repo.MergePullRequest) ``` - here the sample on my **app.ini** ``` [repository.signing] SIGNING_KEY = 152807CD94114E1B0419644A47D1AA5F58E079AF SIGNING_NAME = team SIGNING_EMAIL = team@email.com INITIAL_COMMIT = always CRUD_ACTIONS = pubkey, parentsigned WIKI = never MERGES = always DEFAULT_TRUST_MODEL = committer ``` - **GPG** looks good: ``` $ gpg --fingerprint team@email.com pub rsa2048 2023-05-03 [SC] 152807CD94114E1B0419644A47D1AA5F58E079AF uid [ ultime ] team (Gitea Keys) <team@email.com> sub rsa2048 2023-05-03 [E] ``` - and the gitconfig file: ``` $ cd /home/git/gitea/data/home $ cat .gitconfig [user] name = team email = team@email.com [core] quotePath = false logAllRefUpdates = true commitGraph = true [gc] reflogExpire = 90 writeCommitGraph = true [receive] advertisePushOptions = true procReceiveRefs = refs/for [fetch] writeCommitGraph = true [safe] directory = * [uploadpack] allowfilter = true allowAnySHA1InWant = true ``` I tried also with: ``` & git config --global user.signingkey 152807CD94114E1B0419644A47D1AA5F58E079AF $ git config --global user.name team $ git config --global user.email team@email.fr ``` config added in ``` $ cat /home/git/.gitconfig [user] signingkey = 152807CD94114E1B0419644A47D1AA5F58E079AF name = team email = team@email.fr ``` I'm pretty sure I missed something but I tried different configuration all gpg in **gitconfig** but always the same issue... thanks for your feed back thx for @techknowlogick discord support ### Gitea Version 1.19.0 and 1.19.3 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.31.1 ### Operating System Red Hat Enterprise Linux release 8.7 (Ootpa) ### How are you running Gitea? simple systemd start fresh install and all repo are created with migration tool from 1.14.0, no package, and debuging in consol ``` GITEA_WORK_DIR=/home/git/gitea /usr/local/bin/gitea web -c /etc/gitea/app.ini -p 3001 ``` ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 09:17:49 -06:00
Author
Owner

@8mccm8 commented on GitHub (May 16, 2023):

Hi all,

have you reproduce the bug?

@8mccm8 commented on GitHub (May 16, 2023): Hi all, have you reproduce the bug?
Author
Owner

@DanielGibson commented on GitHub (Jun 17, 2023):

Gitea should use the .gitconfig in [git] HOME_PATH, which in your case should be /home/git/gitea/data/home/ or something like that.

But even if you modify that .gitconfig it might still not work due to this bug I found in Forgejo: https://codeberg.org/forgejo/forgejo/issues/869
(I'd be surprised if Gitea didn't have the same problem).
It boils down to .gitconfig not being used for clients connecting through SSH, because the public key entries Gitea/Forgejo generates in $HOME/.ssh/authorized_keys contain a command that calls forgejo/gitea, and only sets the path to the config, but not the working dir, so it will use $path_of_the_gitea_executable/data/home/ as Git.HOME_PATH

If that bug also exists in Gitea's current development code, it should be fixed before the 1.20 release!

@DanielGibson commented on GitHub (Jun 17, 2023): Gitea *should* use the .gitconfig in [`[git] HOME_PATH`](https://docs.gitea.com/next/administration/config-cheat-sheet#git-git), which in your case should be `/home/git/gitea/data/home/` or something like that. But even if you modify that .gitconfig it might still not work due to this bug I found in Forgejo: https://codeberg.org/forgejo/forgejo/issues/869 (I'd be surprised if Gitea didn't have the same problem). It boils down to .gitconfig not being used for clients connecting through SSH, because the public key entries Gitea/Forgejo generates in $HOME/.ssh/authorized_keys contain a command that calls forgejo/gitea, and only sets the path to the config, but not the working dir, so it will use $path_of_the_gitea_executable/data/home/ as Git.HOME_PATH **If that bug also exists in Gitea's current development code, it should be fixed before the 1.20 release!**
Author
Owner

@DanielGibson commented on GitHub (Jun 18, 2023):

At least "my" bug seems to be fixed in 1.20 rc0 and git.HOME_PATH now defaults to the correct path - @8mccm8 might be worth trying out that version, maybe your bug is fixed as well?

@DanielGibson commented on GitHub (Jun 18, 2023): At least "my" bug seems to be fixed in 1.20 rc0 and git.HOME_PATH now defaults to the correct path - @8mccm8 might be worth trying out that version, maybe your bug is fixed as well?
Author
Owner

@wxiaoguang commented on GitHub (Jun 18, 2023):

What's your app.ini and how did you install Gitea?

By default, [git].HOME_PATH should depend on [server].APP_DATA_PATH, which is an absolute path by default installation. (actually, it needs GITEA_WORK_DIR to be stable)

And , do you have GITEA_WORK_DIR=/home/git/gitea in your systemd service?

@wxiaoguang commented on GitHub (Jun 18, 2023): What's your `app.ini` and how did you install Gitea? By default, `[git].HOME_PATH` should depend on `[server].APP_DATA_PATH`, ~~which is an absolute path by default installation.~~ (actually, it needs `GITEA_WORK_DIR` to be stable) And , do you have `GITEA_WORK_DIR=/home/git/gitea` in your systemd service?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10775