Does the agent do some kind of caching while checking out a repo?

Recently I put a git push in my pipeline and it kept saying “you can’t push because you’r behind of the remote” which was wrong as I was just pushing code to the repo from my device and the agent was pulling from that. Then I realized, when i do git diff inside the server folder the agent is operating, there were many diffs which belong to the commits way older. I cleaned up the folder the agent was operating and then it started to work as expected. So i guess this is related to the how buildkite works. What is the underlying reason behind it? I expect a fresh run in each trigger.

Hey @muratgozel!

We use git mirrors on the agent, which we hope speeds up long checkouts as it maintains a mirror on the agent, however it may lead to “stale” commits on that mirror. If you’re doing pushes on the agent then we’d advise setting BUILDKITE_CLEAN_CHECKOUT=true in your environment to force a fresh checkout each time.

Cheers!

1 Like