|
|
|
@ -194,7 +194,7 @@ func (g *GoGit) Commit(message git.Commit, opts ...git.Option) (string, error) {
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if options.GPGSigningInfo != nil && options.GPGSigningInfo.PrivateKeyPath != "" {
|
|
|
|
|
if options.GPGSigningInfo != nil {
|
|
|
|
|
entity, err := getOpenPgpEntity(*options.GPGSigningInfo)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
@ -260,7 +260,7 @@ func isRemoteBranchNotFoundErr(err error, ref string) bool {
|
|
|
|
|
func getOpenPgpEntity(info git.GPGSigningInfo) (*openpgp.Entity, error) {
|
|
|
|
|
r, err := os.Open(info.PrivateKeyPath)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
return nil, fmt.Errorf("unable to open gpg private key %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entityList, err := openpgp.ReadKeyRing(r)
|
|
|
|
@ -269,7 +269,7 @@ func getOpenPgpEntity(info git.GPGSigningInfo) (*openpgp.Entity, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if len(entityList) == 0 {
|
|
|
|
|
return nil, fmt.Errorf("no entity formed")
|
|
|
|
|
return nil, fmt.Errorf("no GPP entity formed")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var entity *openpgp.Entity
|
|
|
|
@ -281,7 +281,7 @@ func getOpenPgpEntity(info git.GPGSigningInfo) (*openpgp.Entity, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if entity == nil {
|
|
|
|
|
return nil, fmt.Errorf("no key matching the key id was found")
|
|
|
|
|
return nil, fmt.Errorf("no gpg private key matching the key id was found")
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
entity = entityList[0]
|
|
|
|
@ -289,7 +289,7 @@ func getOpenPgpEntity(info git.GPGSigningInfo) (*openpgp.Entity, error) {
|
|
|
|
|
|
|
|
|
|
err = entity.PrivateKey.Decrypt([]byte(info.Passphrase))
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
return nil, fmt.Errorf("unable to decrypt private key: %s", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return entity, nil
|
|
|
|
|