Skip to content

Copilot CLI incorrectly infers repository owner, ignoring git remote configuration #1178

Closed

Description

@bluedog13

Describe the bug

Copilot CLI incorrectly infers the repository owner/organization, even when the git remote is correctly configured.

In my case, the remote is set to a private GitHub Enterprise (GHE/EMU) organization, but Copilot CLI infers a different owner instead.

Affected version

Steps to reproduce

  1. Clone a repository from a private GHE/EMU organization (e.g., git clone git@github.com:MyEnterpriseOrg/my-repo.git)
  2. Verify the remote is correct: git remote get-url origin shows the correct enterprise org
  3. Run a Copilot CLI command that references the repository, e.g.:
    copilot -p "Show me this week's commits and summarize them" --allow-tool 'shell(git)'
  4. Observe that Copilot infers a different/wrong owner

Expected behavior

Copilot CLI should parse the git remote URL and correctly identify the owner from the configured remote.

Actual behavior

Copilot CLI infers a different owner, possibly due to:

  • Hardcoded defaults or legacy config
  • Incorrect parsing of the remote URL or directory structure
  • Internal cache or mapping that doesn't update when changing directories/remotes
  • Issue specific to GHE/EMU organization handling

Related issues

Additional context

  • Repository is in a private GitHub Enterprise (EMU) organization
  • This may be related to session caching or how the CLI resolves enterprise vs non-enterprise orgs

Activity

  1. added
    area:enterpriseGitHub Enterprise (GHE/GHES) support, org policies, and enterprise settings
    on Apr 6, 2026
  2. patniko commented on Oct 26, 2026

    @patniko
    Collaborator

    Thanks for reporting this. Copilot CLI v1.0.29 changed how the agent identifies the repository: it now reads the owner from the git remote URL instead of guessing it (for example from your local username), the same fix as #1328, and v1.0.97 also fixed parsing of GitHub SCP-style remotes with absolute paths. If the CLI still infers the wrong owner for your enterprise repository on the latest version, please reopen with copilot --version and the remote URL format (the org name can be redacted).

    Triaged as part of a Copilot SDK backlog review, with help from GitHub Copilot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:enterpriseGitHub Enterprise (GHE/GHES) support, org policies, and enterprise settings

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions