I am trying to understand whether surjectivity is needed for a fiber product of non-abelian groups to exist. I seem to have checked that the usual construction works for groups without any assumptions. This must not be the case, since Lang only states that this works for abelian groups, and for arbitrary groups various sources define fiber product of two morphisms of groups only if one is surjective.
(See Pull-backs of diagrams of groups with free product. - the assumption is that one of the morphisms is surjective, just like in http://people.brandeis.edu/~igusa/Math101b/pback.pdf Definition 24.2. In Lang's Algebra, exercise 50, p.80 "Show that fiber products exist in the category of abelian groups".)
What am I missing? What is an example of two group homomorphisms without a fiber product? Or, if there is no problem, why do people only define it in the surjective case?
Given two group homomorphisms $m_1:H\to G$ and $m_2:F\to G$, I can form a subset $E \subset H\times F$ of pairs $(h, f)$ with $m_1(h)=m_2(f)$. I check that it's a subgroups. The two projection maps $p_1 (h,f)=h, p_2(h,f)=f$ make the square with $m_1$ and $m_2$. commute.
I check the universal property.
Given $Q$ with homomorphisms $q_1:Q \to H$ and $q_2:Q \to F$ such that $m_1 q_1 (q)= m_2q_2(q)$, I can define product homomorphism $i:Q \to H\times F$, $i(q)=(q_1(q), q_2(q))$. This lands in $E$ and trivially $p_1 i =q_1$ and $p_2 i =q_2$.
To check uniqueness of such map, suppose $j:Q \to E \subset H\times F$ is a map which has $p_1 j =q_1$ and $p_2 j =q_2$. Then $j(q)=((q_1(q), q_2(q))=i(q)$.