- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6.2k
Improve instance wide ssh commit signing #34341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            wxiaoguang
  merged 52 commits into
  go-gitea:main
from
ChristopherHX:improve-instance-wide-ssh-signing
  
      
      
   
  Jun 11, 2025 
      
    
  
     Merged
                    Changes from 25 commits
      Commits
    
    
            Show all changes
          
          
            52 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      fc8fc5a
              
                Improve instance wide ssh commit signing
              
              
                ChristopherHX 0a35694
              
                fix code style
              
              
                ChristopherHX 999860c
              
                fix error style
              
              
                ChristopherHX 6a29629
              
                add copyright
              
              
                ChristopherHX 6957ba9
              
                set default key format to openpgp
              
              
                ChristopherHX 7859346
              
                Cleanup CommitTreeOpts
              
              
                ChristopherHX 3c363c5
              
                add missing docs
              
              
                ChristopherHX 3e992a0
              
                add missing endpoint
              
              
                ChristopherHX a73ccb4
              
                Update modules/git/repo_gpg.go
              
              
                ChristopherHX 8007fba
              
                update app.example.ini
              
              
                ChristopherHX 3123281
              
                Merge branch 'main' of https://github.com/go-gitea/gitea into pr/Chri…
              
              
                ChristopherHX bafd8ec
              
                Merge branch 'improve-instance-wide-ssh-signing' of https://github.co…
              
              
                ChristopherHX 6ae80f9
              
                Update modules/git/command.go
              
              
                ChristopherHX 6c0feaa
              
                Update modules/git/command.go
              
              
                ChristopherHX 98bcc7c
              
                fix indent
              
              
                ChristopherHX 4a6daf1
              
                Merge branch 'main' into improve-instance-wide-ssh-signing
              
              
                techknowlogick dce3797
              
                reuse gpg tests and expand them to ssh
              
              
                ChristopherHX 48a1d6d
              
                rename keyID to key
              
              
                ChristopherHX e749a14
              
                update comment that signKey.KeyID may be empty
              
              
                ChristopherHX 984557d
              
                improve example description
              
              
                ChristopherHX 727429a
              
                Merge branch 'main' of https://github.com/go-gitea/gitea into pr/Chri…
              
              
                ChristopherHX da2c19e
              
                format test code
              
              
                ChristopherHX 39eda94
              
                fix error handling in test
              
              
                ChristopherHX e45c6fb
              
                handle another error in test
              
              
                ChristopherHX 66194b2
              
                remove dead code
              
              
                ChristopherHX d3af10f
              
                fix error handling and add comments about what function verifies whic…
              
              
                ChristopherHX c0b65ef
              
                apply suggestion do not write error to already written response
              
              
                ChristopherHX 64729ae
              
                update comments
              
              
                ChristopherHX 5af804a
              
                do not ignore fingerprint calc error
              
              
                ChristopherHX 0f413c5
              
                Add TestTrustedSSHKeys Test via mocked repo
              
              
                ChristopherHX d8e123a
              
                fix typo
              
              
                ChristopherHX 6f18abc
              
                fix invalid APIErrorNotFound usage
              
              
                ChristopherHX 3da6646
              
                add  missing fixtures
              
              
                ChristopherHX 9c8837b
              
                Use pointer to git.SigningKey
              
              
                ChristopherHX 6f6ddd0
              
                fix fixture
              
              
                ChristopherHX 59eed16
              
                .
              
              
                ChristopherHX 82e7e2d
              
                fix more tests
              
              
                ChristopherHX 452f58b
              
                finally fix another test
              
              
                ChristopherHX edb4486
              
                Merge branch 'main' of https://github.com/go-gitea/gitea into pr/Chri…
              
              
                ChristopherHX 494921a
              
                fix my own test to use master branch
              
              
                ChristopherHX 3824905
              
                remove verify of GetRepositoryDefaultPublicGPGKey for ssh and test fo…
              
              
                ChristopherHX e3ec65f
              
                Merge branch 'main' into improve-instance-wide-ssh-signing
              
              
                wxiaoguang c771cd6
              
                refactor ParseCommitWithSSHSignature
              
              
                wxiaoguang 745a690
              
                resolve fixme
              
              
                ChristopherHX f3710a3
              
                fix test api usage
              
              
                ChristopherHX 6b67a54
              
                do not crash the test if signinguser is nil
              
              
                ChristopherHX 6d119a0
              
                merge duplicate code and improve err handling
              
              
                wxiaoguang 7655f5d
              
                rename consts to match SigningKey.Format
              
              
                wxiaoguang b3997e3
              
                add some comments
              
              
                wxiaoguang 1f4ff81
              
                fix lint
              
              
                ChristopherHX 70ae40f
              
                Update default setting comment
              
              
                ChristopherHX 052257c
              
                Merge branch 'main' into improve-instance-wide-ssh-signing
              
              
                wxiaoguang File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2025 The Gitea Authors. All rights reserved. | ||
| // SPDX-License-Identifier: MIT | ||
|  | ||
| package git | ||
|  | ||
| // Based on https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgformat | ||
| const ( | ||
| // KeyTypeOpenPGP is the key type for GPG keys, expected default of git cli | ||
| KeyTypeOpenPGP = "openpgp" | ||
| // KeyTypeSSH is the key type for SSH keys | ||
| KeyTypeSSH = "ssh" | ||
| ) | ||
|  | ||
| type SigningKey struct { | ||
| KeyID string | ||
| Format string | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.