Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

create `.ollama` directory if it doesnt exist

Jeffrey Morgan148f0225c0e6
diff --git a/server/auth.go b/server/auth.go
index d7803a2b4..f5aaa6b1e 100644
--- a/server/auth.go
+++ b/server/auth.go
@@ -9,7 +9,6 @@ import (
"encoding/json"
"fmt"
"io"
- "io/ioutil"
"log"
"net/http"
"os"
@@ -62,9 +61,14 @@ func getAuthToken(redirData AuthRedirect, regOpts *RegistryOptions) (string, err
return "", err
}
- keyPath := path.Join(home, ".ollama/id_ed25519")
+ keyPath := path.Join(home, ".ollama", "id_ed25519")
- rawKey, err := ioutil.ReadFile(keyPath)
+ err = os.MkdirAll(path.Dir(keyPath), 0700)
+ if err != nil {
+ return "", fmt.Errorf("could not create .ollama directory %w", err)
+ }
+
+ rawKey, err := os.ReadFile(keyPath)
if err != nil {
log.Printf("Failed to load private key: %v", err)
return "", err