gpg sign pr failed #10552

Closed
opened 2025-11-02 09:11:04 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @tosone on GitHub (Mar 29, 2023).

Description

Create pr then squash commit the pr

image

I will get 500 error page.

gitea log:

2023/03/29 16:40:49 ...dules/git/command.go:255:Run() [D] /tmp/gitea/local-repo/pull.git3269640365: /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= commit --author='tosone <i@tosone.cn>' --message=feat: update read config (#6)

	Co-authored-by: Tosone <i@tosone.cn>\015
	Reviewed-on: https://git.tosone.cn/smallforest/EmailManager/pulls/6 -S095A8273BDB3304E1B7327859B64EDC2801F197B
2023/03/29 16:40:49 ...pull/merge_squash.go:41:doMergeStyleSquash() [E] git commit PR[7]smallforest/EmailManager#6[main...tosone]: exit status 128

	error: gpg failed to sign the data
	fatal: failed to write commit object

2023/03/29 16:40:49 ...ers/web/repo/pull.go:1084:MergePullRequest() [E] Merge: git commit [smallforest/EmailManager:tosone -> smallforest/EmailManager:main]: exit status 128

	error: gpg failed to sign the data
	fatal: failed to write commit object

in the gitea container I try to create a test repo and commit with gpg:

image

gitea conf:

[server]
APP_DATA_PATH     = /data
[repository.signing]
SIGNING_KEY = default
SIGNING_NAME = Tosone
SIGNING_EMAIL = i@tosone.cn
MERGES = always
INITIAL_COMMIT = always
WIKI = always
CRUD_ACTIONS = always

.gitconfig

[user]
	name = Tosone
	email = i@tosone.cn
	signingKey = 095A8273BDB3304E1B7327859B64EDC2801F197B
[commit]
	gpgsign = true
[core]
	quotePath = false
	commitGraph = true
	logAllRefUpdates = true
[receive]
	advertisePushOptions = true
	procReceiveRefs = refs/for
[gc]
	writeCommitGraph = true
	reflogExpire = 90
[fetch]
	writeCommitGraph = true
[safe]
	directory = *
[uploadpack]
	allowfilter = true
	allowAnySHA1InWant = true

env

USER_UID=1000
CHARSET=UTF-8
HOSTNAME=gitea
GNUPGHOME=/data/home/.gnupg
PWD=/
USER_GID=1000
HOME=/root
LANG=C.UTF-8
TERM=xterm
USER=git
SHLVL=1
LC_COLLATE=C
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
GITEA_CUSTOM=/data/gitea
_=/usr/bin/env

Gitea Version

v1.19

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

in docker container

Database

PostgreSQL

Originally created by @tosone on GitHub (Mar 29, 2023). ### Description Create pr then squash commit the pr <img width="764" alt="image" src="https://user-images.githubusercontent.com/5346506/228610894-6c0b03ca-4d7e-45c5-bb41-cf57350ee475.png"> I will get 500 error page. gitea log: ``` 2023/03/29 16:40:49 ...dules/git/command.go:255:Run() [D] /tmp/gitea/local-repo/pull.git3269640365: /usr/bin/git -c protocol.version=2 -c credential.helper= -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= commit --author='tosone <i@tosone.cn>' --message=feat: update read config (#6) Co-authored-by: Tosone <i@tosone.cn>\015 Reviewed-on: https://git.tosone.cn/smallforest/EmailManager/pulls/6 -S095A8273BDB3304E1B7327859B64EDC2801F197B 2023/03/29 16:40:49 ...pull/merge_squash.go:41:doMergeStyleSquash() [E] git commit PR[7]smallforest/EmailManager#6[main...tosone]: exit status 128 error: gpg failed to sign the data fatal: failed to write commit object 2023/03/29 16:40:49 ...ers/web/repo/pull.go:1084:MergePullRequest() [E] Merge: git commit [smallforest/EmailManager:tosone -> smallforest/EmailManager:main]: exit status 128 error: gpg failed to sign the data fatal: failed to write commit object ``` in the gitea container I try to create a test repo and commit with gpg: <img width="644" alt="image" src="https://user-images.githubusercontent.com/5346506/228611590-f4ebcf61-35c1-40db-a02e-4e68753dcb6c.png"> gitea conf: ``` [server] APP_DATA_PATH = /data [repository.signing] SIGNING_KEY = default SIGNING_NAME = Tosone SIGNING_EMAIL = i@tosone.cn MERGES = always INITIAL_COMMIT = always WIKI = always CRUD_ACTIONS = always ``` .gitconfig ``` [user] name = Tosone email = i@tosone.cn signingKey = 095A8273BDB3304E1B7327859B64EDC2801F197B [commit] gpgsign = true [core] quotePath = false commitGraph = true logAllRefUpdates = true [receive] advertisePushOptions = true procReceiveRefs = refs/for [gc] writeCommitGraph = true reflogExpire = 90 [fetch] writeCommitGraph = true [safe] directory = * [uploadpack] allowfilter = true allowAnySHA1InWant = true ``` env ``` USER_UID=1000 CHARSET=UTF-8 HOSTNAME=gitea GNUPGHOME=/data/home/.gnupg PWD=/ USER_GID=1000 HOME=/root LANG=C.UTF-8 TERM=xterm USER=git SHLVL=1 LC_COLLATE=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin GITEA_CUSTOM=/data/gitea _=/usr/bin/env ``` ### Gitea Version v1.19 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? in docker container ### Database PostgreSQL
GiteaMirror added the type/bugissue/needs-feedback labels 2025-11-02 09:11:04 -06:00
Author
Owner

@Zettat123 commented on GitHub (Mar 31, 2023):

I tested squash commit with gpg sign and looks like it works well. I noticed that you used /data/home/.gnupg as GNUPGHOME in your envs. Maybe the git user doesn't have write permission for this directory (I'm not sure). Could you please change GNUPGHOME to /data/git/.gnupg and test again?

@Zettat123 commented on GitHub (Mar 31, 2023): I tested squash commit with gpg sign and looks like it works well. I noticed that you used `/data/home/.gnupg` as `GNUPGHOME` in your envs. Maybe the `git` user doesn't have write permission for this directory (I'm not sure). Could you please change `GNUPGHOME` to `/data/git/.gnupg` and test again?
Author
Owner

@tosone commented on GitHub (Apr 3, 2023):

sorry for the late. you are right, the reason is permission.

GNUPGHOME=/data/home/.gnupg

but the directory permission like this:

-rw-r--r--    1 git      git            425 Mar 29 16:40 .gitconfig
drwx------    4 root     root          4096 Mar 29 16:44 .gnupg

chown -R git:git ./.gnupg/

everything will be ok.

/data/git/.gnupg as GNUPGHOME is not necessary.

@tosone commented on GitHub (Apr 3, 2023): sorry for the late. you are right, the reason is permission. GNUPGHOME=/data/home/.gnupg but the directory permission like this: ``` -rw-r--r-- 1 git git 425 Mar 29 16:40 .gitconfig drwx------ 4 root root 4096 Mar 29 16:44 .gnupg ``` chown -R git:git ./.gnupg/ everything will be ok. /data/git/.gnupg as GNUPGHOME is not necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10552