YES, protons do repel each others in the nucleus due to the positive electric charges they posses, BUT, they also are massive particles and they possess color charges. And the same holds for neutrons: massive and color charge.
(Strong nuclear force, that attracts particles based on their strong nuclear charges, a.k.a. "color charges")
From gravity, protons and neutrons do attract each others, but the gravity force is so weak compare to the protons' electromagnetic repulsion that its effect is irrelevant.
On the other hand, the strong nuclear force is a strong force (compare to electromagnetism), but only has effect at very short distances, about the size of the atom nucleus. And this is what hold the proton (and the neutron) together.
Note that the electrons do not have color charges, which is why they espace from the nucleus, but are bounded to it due to the electromagnetism attraction.
But the strong force has its limits against the electromagnestim repulsion. This is why the neutrons are important for large nucleus (with large number of protons) to counter the electromagnetic repulsion.