Skip to content

could not resolve remote "origin": none of the git remotes configured for this repository correspond to the GH_HOST environment variable. #10891

@scr-oath

Description

@scr-oath

Describe the bug

When using GH_HOST, GH_REPO, and GH_ENTERPRISE_TOKEN in conjunction with gh pr create, it started failing about a week ago for us, and we can't reproduce as a human (even with a token) or determine any glaring differences between the CI/CD and local invocations of the same tool, nor even with any version bumps since the last working version (even if we downgrade to 2.70.0, it still fails now 2.70.0 still works actually).

could not resolve remote "origin": none of the git remotes configured for this repository correspond to the GH_HOST environment variable. Try adding a matching remote or unsetting the variable

Some of the settings/troubleshooting attempts

GH_HOST=our.enterprise.host
GH_REPO=out.enterprise.host/ourorg/ourrepo
GH_ENTERPRISE_TOKEN=<set to something>
GH_DEBUG=true

00:00:45 + git remote -v
00:00:45 origin	git@our.enterprise.host:ourorg/ourrepo (fetch)
00:00:45 origin	git@our.enterprise.host:ourorg/ourrepo (push)
00:00:45 + git version
00:00:45 git version 2.43.5
00:00:45 + gh version
00:00:45 gh version 2.71.2 (2025-04-24)
00:00:45 + git config --get-regexp '^branch\.autoupdate/20250428-183455\.(remote|merge|pushremote|gh-merge-base)$'
00:00:45 branch.autoupdate/20250428-183455.remote origin
00:00:45 branch.autoupdate/20250428-183455.merge refs/heads/autoupdate/20250428-183455
00:00:45 + git rev-parse --symbolic-full-name 'autoupdate/20250428-183455@{push}'
00:00:45 refs/remotes/origin/autoupdate/20250428-183455

and invocation

00:00:45 + gh pr create --label autoupdate-server_admap --title '[autoupdate][20250428-183455] Update files from source folder' --body 'This PR is a result of script, which auto update files from the source directory.'
00:00:45 [git remote -v]
00:00:45 [git config --get-regexp ^remote\..*\.gh-resolved$]
00:00:45 * Request at 2025-04-28 18:34:59.675488605 +0000 UTC m=+0.085715954
00:00:45 * Request to https://our.enterprise.host/api/graphql
00:00:46 * Request took 245.740739ms
00:00:46 [git status --porcelain]
00:00:46 [git symbolic-ref --quiet HEAD]
00:00:46 [git config --get-regexp ^branch\.autoupdate/20250428-183455\.(remote|merge|pushremote|gh-merge-base)$]
00:00:46 [git rev-parse --symbolic-full-name autoupdate/20250428-183455@{push}]
00:00:46 could not resolve remote "origin": none of the git remotes configured for this repository correspond to the GH_HOST environment variable. Try adding a matching remote or unsetting the variable

Affected version

Please run gh version and paste the output below.

gh version 2.71.2 (2025-04-24)

Steps to reproduce the behavior

  1. Have an enterprise server
  2. Set the GH_HOST, GH_REPO, GH_ENTERPRISE_TOKEN appropriately
  3. Have an origin with ssh-formatted location (not quite URL but git@ style)

Expected vs actual behavior

A PR should be created (and was up until a week ago); the error regarding inability to find the origin is output and a failure rc is returned.

Logs

See invocation above

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-prrelating to the gh pr commandmore-info-neededMore info needed from user/contributorneeds-triageneeds to be reviewed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions