mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Improve instance wide ssh commit signing (#34341)
* Signed SSH commits can look in the UI like on GitHub, just like gpg keys today in Gitea * SSH format can be added in gitea config * SSH Signing worked before with DEFAULT_TRUST_MODEL=committer `TRUSTED_SSH_KEYS` can be a list of additional ssh public key contents to trust for every user of this instance Closes #34329 Related #31392 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
type CommitTreeOpts struct {
|
||||
Parents []string
|
||||
Message string
|
||||
KeyID string
|
||||
Key *SigningKey
|
||||
NoGPGSign bool
|
||||
AlwaysSign bool
|
||||
}
|
||||
@@ -43,8 +43,13 @@ func (repo *Repository) CommitTree(author, committer *Signature, tree *Tree, opt
|
||||
_, _ = messageBytes.WriteString(opts.Message)
|
||||
_, _ = messageBytes.WriteString("\n")
|
||||
|
||||
if opts.KeyID != "" || opts.AlwaysSign {
|
||||
cmd.AddOptionFormat("-S%s", opts.KeyID)
|
||||
if opts.Key != nil {
|
||||
if opts.Key.Format != "" {
|
||||
cmd.AddConfig("gpg.format", opts.Key.Format)
|
||||
}
|
||||
cmd.AddOptionFormat("-S%s", opts.Key.KeyID)
|
||||
} else if opts.AlwaysSign {
|
||||
cmd.AddOptionFormat("-S")
|
||||
}
|
||||
|
||||
if opts.NoGPGSign {
|
||||
|
Reference in New Issue
Block a user