A unified phase-field theory is introduced to describe crack initiation and early crack growth due to pitting corrosion of pipelines in contact with near-neutral pH groundwater. The model incorporates a formulation that accounts for stochastic corrosion-induced crack nucleation events at pit sites. This approach supplies a modeling framework to handle the combined effects of electrochemical transformation of the original metal, hydrogen diffusion and resulting embrittlement of the original metal, and mechanical stresses. This is a robust computational approach to tracking the evolving metalelectrolyte interface and embrittlement regions. It was confirmed that dissolved hydrogen into the material promotes crack initiation over a wide potential range and that pitting corrosion, as a precursor of stress corrosion cracking, has a recognizable influence on strength over time. It is expected that this work provides the ground for modeling the pit-to-crack transition required to effectively control very slow crack-in-colonies in pipelines.