Skip to content

Include the port in the git-credential host field#82

Merged
Soph merged 1 commit into
mainfrom
fix/credential-host-port
Jun 17, 2026
Merged

Include the port in the git-credential host field#82
Soph merged 1 commit into
mainfrom
fix/credential-host-port

Conversation

@Soph

@Soph Soph commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Problem

credentialInput (internal/auth/auth.go) built the git-credential request with host=<hostname>, using ep.Hostname() which drops the port. gitcredentials(7) defines host as host[:port], so on a non-default-port remote:

  • the git credential fill query never matched the stored entry (credentials silently not found), and
  • approve/reject wrote to the default-port entry, polluting the wrong key.

Fix

Emit ep.Host, which keeps any non-default port. The empty-host guard still uses Hostname(). This matches entiredb.go, which already keys on ep.Host (port-aware) — credentialInput was the lone outlier. All three credential operations (fill/approve/reject) funnel through this function, so they stay consistent.

Tests

TestCredentialInput_IncludesPort asserts host=example.com:8443 for a non-default-port endpoint. Existing port-less cases are unchanged.

🤖 Generated with Claude Code


Note

Low Risk
Small, targeted auth helper fix with a new unit test; no API or security-model changes beyond correct credential lookup keys.

Overview
Fixes git credential helper keying for remotes on non-default ports by writing host=host:port in credentialInput instead of hostname-only.

credentialInput now emits ep.Host (per gitcredentials(7)) for fill/approve/reject, matching how Entire DB credential lookup already keys hosts. Default-port URLs are unchanged.

Adds TestCredentialInput_IncludesPort for example.com:8443.

Reviewed by Cursor Bugbot for commit 8bccb56. Configure here.

credentialInput emitted host=<hostname>, dropping any non-default port.
gitcredentials(7) defines host as "host[:port]", so on a non-default-port
remote the fill query never matched the stored entry and approve/reject wrote
to the default-port entry instead. Emit ep.Host (which keeps the port); the
empty-host guard still uses Hostname().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: a384992be26e
@Soph Soph merged commit d67c10d into main Jun 17, 2026
4 checks passed
@Soph Soph deleted the fix/credential-host-port branch June 17, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants