diff --git a/internal/cmd/configssh.go b/internal/cmd/configssh.go index 5da6745c..2bf2133c 100644 --- a/internal/cmd/configssh.go +++ b/internal/cmd/configssh.go @@ -130,11 +130,12 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st } err = writeSSHKey(ctx, client, privateKeyFilepath) if err != nil { - return xerrors.Errorf("fetch and write ssh key: %w", err) + fmt.Printf("Your private ssh key already exists at \"%s\"\nYou may need to remove the existing file and re-run this command\n", privateKeyFilepath) + } else { + fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath) } fmt.Printf("An auto-generated ssh config was written to \"%s\"\n", *configpath) - fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath) fmt.Println("You should now be able to ssh into your environment") fmt.Printf("For example, try running\n\n\t$ ssh coder.%s\n\n", envs[0].Name) return nil