We have the following generalization (this can e.g. be found in Munkres "Topology", 3rd edition):
All spaces are assumed to be connected, locally path connected.
Lemma 79.1 (The general lifting lemma):
Let $p: E\to X$ be a covering map; let $p(e_0) = x_0$. Let $f: Y\to X$ be a continuous map with $f(y_0) = x_0$. The map $f$ can be lifted to a map $\tilde f: Y \to E$ such that $\tilde f(y_0) = e_0$ if and only if $ f_\ast (\pi_1(Y,y_0)) \subset p_\ast(\pi_1(E,e_0))$ Furthermore, if such a lifting exists, it is unique.
Sketch of Proof: The "only if" direction follows immediately from $f_\ast(\pi_1(Y,y_0)) = (p_\ast\circ \tilde f_\ast)(\pi_1(Y,y_0)) \subset p_\ast(\pi_1(E,e_0))$ For the other direction, we really don't have much of a choice in the definition of $\tilde f$: Given $y\in Y$, choose a path $\gamma: [0,1]\to Y$ from $y_0$ to $y$. Then $f\circ \gamma$ is a path from $x_0$ to $f(y)$ and we want $f\circ \gamma = p\circ (\tilde f\circ \gamma)$ So $\tilde f\circ \gamma$ must necessarily be a lifting of $f\circ \gamma$, starting at $e_0$.
In particular, we must have $\tilde f(y) = \tilde f(\gamma(1)) = \text{endpoint of the lifting of $f\circ \gamma$}$ Now local path-connectedness is used to show that this map is in fact continuous and the condition on the image of the fundamental group is used to prove that $\tilde f$ is well-defined.