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

Shared build agents run as one user, and developers worry about stored Git credentials.

IntermediateScenarioSecrets, Signing and Security
Answer

Situation read → Credentials cached on shared hosts can leak between jobs.

What I'd do →

  1. Do not use credential.helper store (plain text). Use ephemeral tokens injected per job.
  2. In GitHub Actions use GITHUB_TOKEN via actions/checkout, set persist-credentials: false if later steps do not need Git.
  3. Use ephemeral or containerised runners that are destroyed after each job.
  4. Clean ~/.git-credentials and agent sockets if the host is reused.

Why → Per-job short-lived credentials leave nothing behind to steal.

Interview tip → Self-hosted runners on public repos are a serious risk; avoid them or isolate them.

All Git & GitHub questions Roadmap: Git & GitHub

More on Secrets, Signing and Security