Skip to content

fix(vcs): discover private repositories of personal accounts - #42

Merged
clouddrove-ci merged 1 commit into
masterfrom
fix/private-repo-discovery
Aug 19, 2026
Merged

fix(vcs): discover private repositories of personal accounts#42
clouddrove-ci merged 1 commit into
masterfrom
fix/private-repo-discovery

Conversation

@clouddrove-ci

Copy link
Copy Markdown
Member

What

git-sync silently mirrored only the public half of a GitHub personal account, and failed outright on a GitLab user namespace.

Why

Listing fell back to GET /users/{owner}/repos when the owner was not an organisation. GitHub documents that endpoint as returning public repositories only, and it does not widen for an authenticated caller. The run reported 0 selected with no error, which is indistinguishable from a mirror that is up to date.

GitLab only ever tried GET /groups/{owner}/projects, which 404s for a personal namespace, so the whole mirror died at the discover stage.

Changes

  • GitHub: when the token belongs to the configured owner (resolved once via GET /user, cached per run), list through GET /user/repos?visibility=all&affiliation=owner. Mirroring another account still uses the public listing, since no credential can see further.
  • GitLab: a 404 on the first page of the group endpoint falls back to GET /users/{owner}/projects. A non-404 error still fails, and a 404 partway through pagination is still a real failure rather than a reason to restart against a different endpoint.
  • A mirror whose discovery succeeds but reports no repositories at all now warns and names the likely cause.
  • Runbook and token table document the personal-account rule and fine-grained PAT repository access.

Audit of the other providers

No change needed. Bitbucket /repositories/{workspace} returns private repositories to an authenticated caller, Azure DevOps lists project-scoped repositories which are private by default, and CodeCommit ListRepositories is account scoped.

Testing

Four new tests: the token owner uses the authenticated endpoint with visibility=all, another account uses the public endpoint, GitLab falls back to the user namespace, and a GitLab 401 does not trigger the fallback. verify-syncerd full tier passes.

git-sync listed a GitHub personal account through GET /users/{owner}/repos,
which returns public repositories only whatever token is presented, so private
repositories were silently missing from every run with no error to point at.
When the token belongs to the configured owner, list through
GET /user/repos?visibility=all&affiliation=owner instead, which reports them.
Mirroring another account still sees its public repositories only, since no
credential can see further.

A GitLab source in a user namespace failed outright at the discover stage,
because only GET /groups/{owner}/projects was tried and it 404s for a personal
namespace. A 404 on the first page now falls back to
GET /users/{owner}/projects.

A mirror whose discovery succeeds but reports nothing now warns and names the
likely cause, since an empty run was otherwise indistinguishable from a mirror
that is up to date.
@clouddrove-ci
clouddrove-ci merged commit 3cdf95a into master Aug 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants