If you remove an agents git definition in admin/agent/viewAgent.action, the definition will return on restart of the agent. It should retain that it was removed.
The state of the agent was confirmed that it was removed by refresh of admin/agent/viewAgent.action as well as viewing the admin/agent/viewCapabilityKey.action?capabilityKey=system.git.executable and admin/viewGlobalAuditLog.action.