Let $X$ be a Hausdorff space that is connected and locally path connected, and let $f : (X,x) \to (S^1,1)$ be a continuous map. Prove that $f$ has a square root (a continuous mapping $g : X \to S^1$ such that $g(x)^2=f(x)$, where the squaring operation comes from complex multiplication) if and only if the image of $f_* : \pi_1(X,x) \to \pi_1(S^1,1) \cong \mathbb Z$ is contained in $2\mathbb Z$.
Can I receive some hints on this? I am unsure how to express $g^2=f$ in terms of the map $f_*$ between the fundamental groups of $X$ and $S^1$, or something.