github / github/gh-gei

gh gei generate fails to list repos for specific GHES org while migrate-repo succeeds

Open
#1,542 0 comments 0 reactions 0 assignees View on GitHub
task
Dominant language
C#
Stars
478
Forks
146
Avg merge
7d 21h
Merged PRs (30d)
2

Description

### Summary

`gh gei generate` fails on a specific GHES organization: the REST GET call used to fetch repo names on the **source** GHES org returns nothing or 404, so the PowerShell output script is not generated.

The same command and PAT work:
- On other GHES organizations
- When swapping source/target with a dummy GHEC org
- When using `gh gei migrate-repo` directly with repo **ADMIN** permissions (which succeeds as expected)

### Environment

- GEI CLI (`gh-gei`) version: v 1.28.0
- `gh` CLI version: Latest
- Source: GitHub Enterprise Server (GHES) v 3.8
- Target: GHEC latest
- PAT type: Classic (legacy) PAT
- PAT scopes:
- `repo`
- `admin:org`
- `read:org`
- workflow
- user all

### What I am doing

Command (redacted):

```bash
GH_ENTERPRISE_TOKEN= \
gh gei generate \
--source-url https://ghe-source.mycompany.com \
--source-org \
--target-org \
--output migrate.ps1 \
```
logs written to vscode!
### Expected behavior
- `gh gei generate` lists repositories from the source org via REST API.
- The PowerShell script (`migrate.ps1`) is generated for that org.

### Actual behavior

- For **this specific GHES org**:
- Verbose logs show REST GET calls to the source GHES API, but the GET that should list repos does **not** retrieve repo names.
- As a result, the script is not generated.
- For other orgs:
- The same token, same user, same command successfully fetches repo names and generates the script.
- For a dummy org on GHEC / swapping source and target:
- Script generation succeeds.
- Using `gh gei migrate-repo` directly:
- Repo migration works with only repo owner permissions, which appears to be the intended behavior.

### Logs / diagnostics

GET https://ghe-sourceorg.myfirm.com/api/v3/orgs//repos
->
404

Contributor guide

Open the contributing guide

Research direction

Start with the gh gei generate path that calls GET /api/v3/orgs//repos, and compare its behavior with the direct migrate-repo path. Use the provided GHES 3.8 reproduction and verbose logs to trace the empty or 404 response. Done means repositories are listed and migrate.ps1 is generated for the affected organization without breaking other organizations.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.