Skip to content

Commit

Permalink
fix: init create .ssh dir
Browse files Browse the repository at this point in the history
Signed-off-by: 张启航 <[email protected]>
  • Loading branch information
ZhangSetSail committed Dec 16, 2024
1 parent ea2b7f0 commit 9a4026f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builder/sources/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,13 @@ func GetPublicKey(tenantID string) string {
if err != nil {
logrus.Error("MakeSSHKeyPairError:", err)
}
sshDir := path.Join(home, ".ssh")
// 确保目录存在
err = os.MkdirAll(sshDir, 0700)
if err != nil {
logrus.Errorf("Failed to create directory: %v\n", err)
return ""
}
PrivateKeyFile, err := os.Create(path.Join(home, "/.ssh/"+PrivateKey))
if err != nil {
logrus.Errorf("create private key failure: %v", err)
Expand Down

0 comments on commit 9a4026f

Please sign in to comment.