Let $\phi: \mathscr{F} \to \mathscr{G}$ be a morphism of sheaves. Recall that $\phi$ is an epimorphism if given $\psi_1, \psi_2: \mathscr{G} \to \mathscr{H}$, then $\psi_1 \circ \phi = \psi_2 \circ \phi$ implies $\psi_1 = \psi_2$.
One direction of this is clear: let $p \in X$ (assuming $\mathscr{F}, \mathscr{G},$ and $\mathscr{H}$ are sheaves on $X$); if $\phi_p: \mathscr{F}_p \to \mathscr{G}$ is surjective for all $p$, then if $\psi_1\circ\phi = \psi_2\circ\phi$, they induce the same map on stalks. $\phi_p$ is surjective on stalks, so is an epimorphism in $\mathsf{Set}$ or $\mathsf{Grp}$ or whatever category. Thus $\psi_{1,p} = \psi_{2,p}$. Maps that are equal on stalks are equal, so $\psi_1 = \psi_2$.
It is the other direction that I'm failing to see clearly. I understand that we must exhibit a sheaf $\mathscr{H}$, along with maps $\psi_1, \psi_2: \mathscr{G} \to \mathscr{H}$ such that the following conditions hold:
- $\psi_1 \circ \phi = \psi_2 \circ \phi$, and
- $\psi_1 = \psi_2$ implies $\phi_p$ is surjective.
Any hints into what the right sheaf or sheaf morphisms to consider are would be greatly appreciated. For reference, this comes from Exercise 2.4.O in Vakil's Algebraic Geometry notes.