1
0
mirror of synced 2026-02-07 03:05:56 +00:00

Update go-git to v5.4.1

Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
Hidde Beydals
2021-05-26 15:56:50 +02:00
parent 92ef39e2ad
commit 465ea5ccfd
3 changed files with 45 additions and 39 deletions

View File

@@ -30,7 +30,6 @@ import (
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"
cryptossh "golang.org/x/crypto/ssh"
corev1 "k8s.io/api/core/v1"
"github.com/fluxcd/flux2/internal/bootstrap"
@@ -233,20 +232,7 @@ func transportForURL(u *url.URL) (transport.AuthMethod, error) {
}, nil
case "ssh":
if bootstrapArgs.privateKeyFile != "" {
// TODO(hidde): replace custom logic with https://github.com/go-git/go-git/pull/298
// once made available in go-git release.
bytes, err := ioutil.ReadFile(bootstrapArgs.privateKeyFile)
if err != nil {
return nil, err
}
signer, err := cryptossh.ParsePrivateKey(bytes)
if _, ok := err.(*cryptossh.PassphraseMissingError); ok {
signer, err = cryptossh.ParsePrivateKeyWithPassphrase(bytes, []byte(gitArgs.password))
}
if err != nil {
return nil, err
}
return &ssh.PublicKeys{Signer: signer, User: u.User.Username()}, nil
return ssh.NewPublicKeysFromFile(u.User.Username(), bootstrapArgs.privateKeyFile, gitArgs.password)
}
return nil, nil
default: