  What remains of a geometrical notion like that of a principal bundle when the
base space is not a manifold but a coarse graining of it, like the poset formed
by a base for the topology ordered under inclusion? Motivated by finding a
geometrical framework for developing gauge theories in algebraic quantum field
theory, we give, in the present paper, a first answer to this question. The
notions of transition function, connection form and curvature form find a nice
description in terms of cohomology, in general non-Abelian, of a poset with
values in a group $G$. Interpreting a 1--cocycle as a principal bundle, a
connection turns out to be a 1--cochain associated in a suitable way with this
1--cocycle; the curvature of a connection turns out to be its 2--coboundary. We
show the existence of nonflat connections, and relate flat connections to
homomorphisms of the fundamental group of the poset into $G$. We discuss
holonomy and prove an analogue of the Ambrose-Singer theorem.
