r/devops • u/NK534PNXMb556VU7p • Nov 04 '26
Discussion What identity is best used for cross-instance work between GitHub Enterprise Server and GitHub cloud?
We have one GitHub Enterprise Server (on-prem) org and one GitHub cloud org. A shared file lives in a repo in one of them, and repos in the other org need the current version. Right now someone copies it by hand, so it drifts out of date without anyone noticing.
Obviously the sync itself is easy to script but the hard part I can't decide on is the principal that actually does the work. Since a GitHub App is scoped to one instance, it can’t act on both sides. That leaves options like a machine user with a PAT, deploy keys, etc.
How are people handling cross-instance automation, and what identity do you use for it? Is there a pattern that avoids a long-lived credential, such as OIDC federation between github instances or an intermediary that I should consider? Also curious what solutions you'd avoid.
Thank you in advance!
1
u/Yierox Nov 04 '26
Can’t you create the gh app in the ‘other’ (target) org, give the client ID and secret to the source org, and write a cron job action or some other trigger to push the contents down to target using those credentials. I don’t understand what you mean by the GitHub app being scoped to one instance. Is the sync happening in both directions?
1
u/seweso Nov 04 '26
Why would you have some weird manual build step to share an artifact between two different clouds?
Single point of definition?
1
u/fletch3555 Lead DevOps Engineer Nov 04 '26
Are these orgs part of the same enterprise? Do you have GitHub Connect setup?
1
u/Immediate_Wheel1953 Nov 04 '26
I would go with the GitHub App route too, but I would put the app in the target org and mint a short-lived installation token in the source workflow rather than reusing a PAT. I learned that the hard way after a PAT I set up for a one-off sync kept getting used for other jobs and nobody remembered to rotate it. Scope it to just that one repo and read-only if you can, and check whether GitHub Connect already covers your case before you build the bridge, since that saved me a lot of custom code on a similar split setup.
1
u/ccuadros_dev 25d ago
OIDC federation is the right instinct — avoid PATs/long-lived creds. Scope the trust by the sub/repo claim with an explicit condition (org/repo/ref), not the whole issuer — otherwise any repo on that instance can assume the identity.