How does a person legally get out of a two person mortgage?

refinance and buy the other person out or sell and split any equity equally, then you will both be out and may be able to start over