Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit bf3feab

Browse files
KevinEdrycmoog
authored andcommitted
fixed ssh key error to better reflect its state. (#139)
Fix config-ssh key file error to better reflect its state Co-authored-by: Charles Moog <[email protected]>
1 parent 847af84 commit bf3feab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/cmd/configssh.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,12 @@ func configSSH(configpath *string, remove *bool) func(cmd *cobra.Command, _ []st
130130
}
131131
err = writeSSHKey(ctx, client, privateKeyFilepath)
132132
if err != nil {
133-
return xerrors.Errorf("fetch and write ssh key: %w", err)
133+
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)
134+
} else {
135+
fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath)
134136
}
135137

136138
fmt.Printf("An auto-generated ssh config was written to \"%s\"\n", *configpath)
137-
fmt.Printf("Your private ssh key was written to \"%s\"\n", privateKeyFilepath)
138139
fmt.Println("You should now be able to ssh into your environment")
139140
fmt.Printf("For example, try running\n\n\t$ ssh coder.%s\n\n", envs[0].Name)
140141
return nil

0 commit comments

Comments
 (0)