York City have signed former Port Vale and Mansfield Town defender John McCombe on a two-and-a-half-year contract.