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 →
- Do not use
credential.helper store(plain text). Use ephemeral tokens injected per job. - In GitHub Actions use
GITHUB_TOKENviaactions/checkout, setpersist-credentials: falseif later steps do not need Git. - Use ephemeral or containerised runners that are destroyed after each job.
- Clean
~/.git-credentialsand 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.
More on Secrets, Signing and Security
A developer pushed an AWS access key to a public repo 10 minutes ago. What is your first move?BeginnerAfter rotating the leaked key, you must purge it from repository history. How?AdvancedA push is rejected: "GH013: Repository rule violations found ... Push cannot contain secrets". What do you do?IntermediateSecret scanning alerts have piled up, and many look like false positives or old test credentials.IntermediateYou must set up signed commits on your laptop. Which method do you pick?BeginnerYour GPG signing key expires next week. What is the correct way to handle it?Intermediate