An agent that writes code has to get its work back into the repository. The simplest setup gives the agent a git key, but then the agent can reach every repository that key reaches, and a mistaken command touches the remote directly. The opposite setup keeps keys away from the agent and lets the platform move the work, which is safer but means the agent cannot fetch or merge mid-run.
Neither is right for every team. A review branch per task with no agent-held key suits most work. Some flows, such as an agent that must merge the latest base branch before it finishes, need the agent to do git itself.