From 2996066da2a507a688b64e8ff2b5ce99d23c8de1 Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Mon, 23 May 2022 18:54:20 -0400 Subject: [PATCH] Don't reuse previous deploy keys Also don't ask people to ssh-add them into their keychain as they can interfere with other git creds --- pkg/scm/keys.go | 36 +----------------------------------- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/pkg/scm/keys.go b/pkg/scm/keys.go index 598a399d..1e4ac217 100644 --- a/pkg/scm/keys.go +++ b/pkg/scm/keys.go @@ -19,11 +19,6 @@ type keys struct { } func generateKeys() (pub string, priv string, err error) { - pub, priv, found := readKeys() - if found { - return - } - pubKey, privKey, err := ed25519.GenerateKey(rand.Reader) if err != nil { return @@ -44,30 +39,6 @@ func generateKeys() (pub string, priv string, err error) { return } -func readKeys() (pub string, priv string, found bool) { - keys, err := keyFiles() - if err != nil { - return - } - - if !utils.Exists(keys.pub) || !utils.Exists(keys.priv) { - return - } - - pub, err = utils.ReadFile(keys.pub) - if err != nil { - return - } - - priv, err = utils.ReadFile(keys.priv) - if err != nil { - return - } - - found = true - return -} - func saveKeys(pub, priv string) error { if !utils.Confirm("Would you like to save the keys to ~/.ssh?") { return nil @@ -90,12 +61,7 @@ func saveKeys(pub, priv string) error { return err } - if sshadd, _ := utils.Which("ssh-add"); sshadd && utils.Confirm("would you like to add this key to your ssh agent (ignore if your git ssh is set up)?") { - return utils.Exec("ssh-add", keys.priv) - } - - utils.Highlight("It looks like ssh isn't configured locally, once you have it set up, you can run `ssh-add ~/.ssh/id_plural` to add the key to your agent") - return err + return nil } func keyFiles() (keys keys, err error) {