I'm reading the Dijkgraaf–Witten paper *Topological gauge theories and group cohomology* (Comm. Math. Phys. **129** (1990) pp 393–429, doi:[10.1007/BF02096988](https://doi.org/10.1007/BF02096988)) and on page 395, 2nd paragraph they write



> 
> Suppose we choose a discrete group $G$. Every principal $G$-bundle has a unique, flat connection, and corresponds to a homomorphism $\lambda : \pi\_1(M) \rightarrow G$
> 
> 
> 


There are two parts to this question: why must such a bundle have a flat connection that's unique? And what exactly is the significance of the second part of the statement (the part about the homomorphism)? 



Why does a principal G-bundle with a discrete structure group G have a unique flat connection?
Tsemo's answer addresses the first part of your question. To answer the second, for $G$ discrete, a $G$-bundle $p:P\to M$ is in particular a covering space for $M$, and so every path in $M$ has a unique lift (which happens to be the horizontal lift for the flat connection discussed in Tsemo's answer). So a closed path $\gamma:[0,1]\to M$ based at $x\in M$ lifts to the path $\tilde\gamma:[0,1]\to P$ (starting at some fixed $q\in p^{-1}(x)$). Since $\tilde\gamma(0)$ and $\tilde\gamma(1)$ lie in the same fibre, they differ by an element of $G$, so we can write $\tilde\gamma(1) = \tilde\gamma(0)\cdot \Lambda(\gamma)$. In fact, homotopies on $M$ also lift to $P$, and so $\Lambda$ factors through $\pi\_1(M)$ to give a map $\lambda:\pi\_1(M)\to G$. It is not too hard to show that $\lambda$ is a homomorphism. $\lambda$ essentially defines $P$ (for $M$ connected): if $\tilde M$ denotes the universal cover of $M$, then $P \simeq \tilde{M}\times\_\lambda G$.


You can find a nice discussion of covering spaces in Hatcher's [Algebraic Topology](https://pi.math.cornell.edu/%7Ehatcher/AT/AT.pdf) (particularly Section 1.3, Lifting Properties). The lifting arguments above apply more generally to principal bundles with flat connections (even if $G$ is not discrete): a discussion of flat bundles and holomorphy homorphisms is contained in Section 2.1.4 of Morita's "Geometry of Characteristic Classes".


