diff --git a/cmd/daytona/config/ssh_file.go b/cmd/daytona/config/ssh_file.go index bbb0a3bdb1..b147bd07cf 100644 --- a/cmd/daytona/config/ssh_file.go +++ b/cmd/daytona/config/ssh_file.go @@ -60,9 +60,15 @@ func ensureSshFilesLinked() error { return err } - newContent := strings.ReplaceAll(string(content), "Include daytona_config\n\n", "") - newContent = strings.ReplaceAll(string(newContent), "Include daytona_config\n", "") - newContent = strings.ReplaceAll(string(newContent), "Include daytona_config", "") + contentStr := string(content) + + if strings.HasPrefix(contentStr, "Include daytona_config") { + return nil + } + + newContent := strings.ReplaceAll(contentStr, "Include daytona_config\n\n", "") + newContent = strings.ReplaceAll(newContent, "Include daytona_config\n", "") + newContent = strings.ReplaceAll(newContent, "Include daytona_config", "") newContent = "Include daytona_config\n\n" + newContent err = os.WriteFile(configFile, []byte(newContent), 0600) if err != nil {