claude-code - 💡(How to fix) Fix [FEATURE] `owner/repo#number` PR shorthand should link to configured GitHub Enterprise host [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48392Fetched 2026-04-16 07:01:28
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
labeled ×2

Fix Action

Fix / Workaround

  • Ask Claude to always include the full URL in PR links — this works but requires a one-time instruction per session or a persistent memory entry, and shouldn't be necessary
    • Manually replace github.com with the GHES host in the generated link each time
    • Configure a CLAUDE.md note reminding Claude to use the full URL — again, a workaround rather than a fix
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When Claude Code references a pull request using the owner/repo#number shorthand, the markdown link behind it always points to https://github.com/owner/repo/pull/number — even when the repository's git remote points to a GitHub Enterprise instance.

Proposed Solution

The hyperlink should resolve against the actual remote host detected from the git config, so that [owner/repo#123](https://ghes.example.com/owner/repo/pull/123) is generated instead of targeting github.com.

Alternative Solutions

  • Ask Claude to always include the full URL in PR links — this works but requires a one-time instruction per session or a persistent memory entry, and shouldn't be necessary
  • Manually replace github.com with the GHES host in the generated link each time
  • Configure a CLAUDE.md note reminding Claude to use the full URL — again, a workaround rather than a fix

A cleaner alternative solution (if inferring from the remote feels too implicit) would be to allow users to configure a githubHost setting in Claude Code's settings, which would be used as the base for all PR link generation.

Priority

Low - Nice to have

Feature Category

CLI commands and flags

Use Case Example

No response

Additional Context

Multiple enterprise teams use GitHub Enterprise Server (GHES) and rarely push to github.com. The short owner/repo#number format is convenient and readable, but the broken link forces users to either navigate manually or ask Claude to spell out the full URL every time.

Claude Code already has access to the git remote URL (e.g. via git remote get-url origin). It could use that to infer the base host when formatting PR links, falling back to github.com when no remote is configured or when the remote is already github.com.

extent analysis

TL;DR

Modify Claude Code to use the git remote URL to infer the base host for PR links, falling back to github.com when necessary.

Guidance

  • Investigate using the git remote get-url origin command to retrieve the git remote URL and extract the base host for PR link generation.
  • Consider adding a githubHost setting in Claude Code's settings to allow users to configure the base host for PR links, providing a more explicit alternative to inferring from the remote.
  • Verify that the generated PR links point to the correct GitHub Enterprise instance by testing with different repository remotes.
  • Evaluate the trade-offs between implicitly inferring the base host from the remote and requiring users to configure the githubHost setting.

Example

import git

# Get the git remote URL
repo = git.Repo()
remote_url = repo.remotes.origin.url

# Extract the base host from the remote URL
base_host = remote_url.split('@')[1].split(':')[0] if '@' in remote_url else remote_url.split('://')[1].split('/')[0]

# Use the base host to generate the PR link
pr_link = f"https://{base_host}/owner/repo/pull/number"

Notes

The solution relies on Claude Code having access to the git remote URL, which is assumed to be available via git remote get-url origin. The githubHost setting provides a more explicit way to configure the base host, but may require additional user configuration.

Recommendation

Apply a workaround by configuring a githubHost setting in Claude Code's settings, allowing users to specify the base host for PR links, as this provides a more explicit and flexible solution.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING