  A connected graph is called \emph{geodetic} if there is a unique geodesic
between each pair of vertices. In this paper we prove that if a finitely
generated group admits a Cayley graph which is geodetic, then the group must be
virtually free. Before now, it was open whether finitely generated and geodetic
implied hyperbolic. In fact we prove something more general: if a
quasi-transitive locally finite connected undirected graph is geodetic then it
is quasi-isometric to a tree. Our main tool is to define a \emph{boundary} of a
graph and understand how the local behaviour influences it when the graph is
geodetic. Our results unify, and represent significant progress on, research
initiated by Ore, Shapiro, and Madlener and Otto.
