Skip to content

Commit

Permalink
fix .ssh folder not present when sync pull
Browse files Browse the repository at this point in the history
  • Loading branch information
AshutoshPatole committed Aug 16, 2024
1 parent 2ded7c6 commit 99a4a3b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ func downloadConfigurations() {
yaml := document.Data()["ssm_yaml"].([]byte)
publicKey := document.Data()["public"].([]byte)
privateKey := document.Data()["private"].([]byte)

// check if .ssh exists at home
sshDir := userHomeDir + "/.ssh"
_, err = os.Stat(sshDir)
if os.IsNotExist(err) {
err = os.MkdirAll(sshDir, 0755)
if err != nil {
logrus.Fatal(err)
}
}

saveFile(path.Join(userHomeDir+"/.ssm.yaml"), yaml, 0644)
saveFile(path.Join(userHomeDir+"/.ssh/id_ed25519.pub"), publicKey, 0644)
saveFile(path.Join(userHomeDir+"/.ssh/id_ed25519"), privateKey, 0600)
Expand Down

0 comments on commit 99a4a3b

Please sign in to comment.