[PR #7868] [CLOSED] server: automatically open browser to connect ollama key #12541

Closed
opened 2026-04-13 00:02:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/7868
Author: @BruceMacD
Created: 11/27/2024
Status: Closed

Base: mainHead: brucemacd/check-key-register


📝 Commits (7)

  • 8582254 server: show user feedback when key is anonymous
  • 4537a89 Update cmd.go
  • d076931 Update error.go
  • a4b3273 fix lint checks
  • e515ac0 remove images_test.go (uses filesystem key)
  • 444640f open connect page in browser
  • ac300ec add noninteractive flag to prevent opening browser

📊 Changes

8 files changed (+172 additions, -14 deletions)

View changed files

📝 cmd/cmd.go (+76 -1)
📝 cmd/cmd_test.go (+26 -9)
📝 envconfig/config.go (+4 -0)
📝 go.mod (+1 -0)
📝 go.sum (+3 -0)
📝 server/images.go (+24 -3)
📝 types/errtypes/errtypes.go (+1 -1)
types/registry/error.go (+37 -0)

📄 Description

When an ollama key is not registered with any account on ollama.com this is not obvious. In the current CLI an error message that the user is not authorized is displayed. This change brings back previous behavior to show the user their key and where they should add it. It protects against adding unexpected keys by checking that the key is available locally.

This change also opens the browser to prompt the user to connect their key, when possible.

A follow-up change should add structured errors from the API. This change just relies on a known error message.

Example output for unregistered key on MacOS:

$ ./ollama push brxce/test
retrieving manifest 
pushing 74701a8c35f6... 100% ▕██████▏ 1.3 GB                         
pushing 966de95ca8a6... 100% ▕██████▏ 1.4 KB                         
pushing fcc5a6bec9da... 100% ▕██████▏ 7.7 KB                         
pushing a70ff7e570d9... 100% ▕█████▏ 6.0 KB                         
pushing 4f659a1e86d7... 100% ▕████▏  485 B                         
pushing manifest 
Opening browser to connect your device...

Example output when browser cannot be opened:

$ ./ollama push brxce/llava                     
retrieving manifest 
Error: unauthorized: unknown ollama key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPB/puRhawCPJJ+rOUQJqW2O6QVuIAKovk7wjTRrhXlF"

Your ollama key is:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPB/puRhawCPJJ+rOUQJqW2O6QVuIAKovk7wjTRrhXlF
Add your key at:
https://ollama.com/settings/keys

How to run this branch

  1. Build the server and CLI (make and go build)
  2. Start the development server
  3. Try to push a model to ollama.com with a key that has not been registered

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/7868 **Author:** [@BruceMacD](https://github.com/BruceMacD) **Created:** 11/27/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `brucemacd/check-key-register` --- ### 📝 Commits (7) - [`8582254`](https://github.com/ollama/ollama/commit/85822544a9ac5694878afb92bb8a422659f28256) server: show user feedback when key is anonymous - [`4537a89`](https://github.com/ollama/ollama/commit/4537a89b26d74a9e70f2c35137a23369aa86e9d1) Update cmd.go - [`d076931`](https://github.com/ollama/ollama/commit/d0769313ed6896c0d55625409fb0b79751febadb) Update error.go - [`a4b3273`](https://github.com/ollama/ollama/commit/a4b32736cfa3e4d0c5fdc7cda49eceffe872a1b1) fix lint checks - [`e515ac0`](https://github.com/ollama/ollama/commit/e515ac0595db3282f4f67e6dcd04e2e8564fcdcb) remove images_test.go (uses filesystem key) - [`444640f`](https://github.com/ollama/ollama/commit/444640f3c724ca366bb7fa916e03c932b2939e99) open connect page in browser - [`ac300ec`](https://github.com/ollama/ollama/commit/ac300ec32b546e743f972eaabaa2bbded04d74bf) add noninteractive flag to prevent opening browser ### 📊 Changes **8 files changed** (+172 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+76 -1) 📝 `cmd/cmd_test.go` (+26 -9) 📝 `envconfig/config.go` (+4 -0) 📝 `go.mod` (+1 -0) 📝 `go.sum` (+3 -0) 📝 `server/images.go` (+24 -3) 📝 `types/errtypes/errtypes.go` (+1 -1) ➕ `types/registry/error.go` (+37 -0) </details> ### 📄 Description When an ollama key is not registered with any account on ollama.com this is not obvious. In the current CLI an error message that the user is not authorized is displayed. This change brings back previous behavior to show the user their key and where they should add it. It protects against adding unexpected keys by checking that the key is available locally. This change also opens the browser to prompt the user to connect their key, when possible. A follow-up change should add structured errors from the API. This change just relies on a known error message. Example output for unregistered key on MacOS: ``` $ ./ollama push brxce/test retrieving manifest pushing 74701a8c35f6... 100% ▕██████▏ 1.3 GB pushing 966de95ca8a6... 100% ▕██████▏ 1.4 KB pushing fcc5a6bec9da... 100% ▕██████▏ 7.7 KB pushing a70ff7e570d9... 100% ▕█████▏ 6.0 KB pushing 4f659a1e86d7... 100% ▕████▏ 485 B pushing manifest Opening browser to connect your device... ``` Example output when browser cannot be opened: ``` $ ./ollama push brxce/llava retrieving manifest Error: unauthorized: unknown ollama key "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPB/puRhawCPJJ+rOUQJqW2O6QVuIAKovk7wjTRrhXlF" Your ollama key is: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPB/puRhawCPJJ+rOUQJqW2O6QVuIAKovk7wjTRrhXlF Add your key at: https://ollama.com/settings/keys ``` ## How to run this branch 1. Build the server and CLI (make and go build) 2. Start the development server 3. Try to push a model to ollama.com with a key that has not been registered --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 00:02:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#12541