Interview Prep/Git & GitHub/Secrets, Signing and Security

A CI server needs read access to one private repo. Deploy key or machine user?

IntermediateScenarioSecrets, Signing and Security
Answer

Situation read → Pick the narrowest credential that fits.

What I'd do →

  1. Deploy key: an SSH key tied to a single repo, read-only by default. Best for one repo.
  2. Machine user: a separate account that can access many repos but consumes a seat and is a standing target.
  3. For many repos, prefer a GitHub App with an installation token.
  4. Rotate keys regularly and store them in the CI secret store.

Why → A deploy key cannot touch other repos, which limits damage.

Interview tip → A deploy key can only be used on one repository at a time.

All Git & GitHub questions Roadmap: Git & GitHub

More on Secrets, Signing and Security