We know that the protons in a nucleus are positively charged. So why does the nucleus stay intact?

Short answer: the strong nuclear force.

The strong nuclear force binds nucleons (protons and neutrons) together. It is a very short-range force, which is why it only acts over distances on the scale of atomic nuclei. There is repulsion between the protons, which is why, as the number of protons goes up, more and more neutrons are required to stabilize the nucleus (look at how atomic mass goes up relative to atomic number on a periodic table). More nucleons (protons and neutrons) means more strong force, and more neutrons means more space between the protons, reducing the repulsion. Together, these effects can produce a stable nucleus.

Stable here is a relative term, since nuclear decay occurs for many isotopes in which the particular number of protons and neutrons isn't stable in the long term (sometimes very long). All elements above lead on the periodic table have too many protons and are all radioactive, since no number of neutrons is able to fully stabilize the atoms against nuclear decay. This is partly a result of the proton-proton repulsion you refer to.