The double negative here should be cleaned up to be more clear. For instance:

if remote_status.exitstatus == 2 && remote_status.stdout.strip != remote_url

I believe the point of this code is to replace the URL if there is more than one value set (exit code 2, fixed with --replace-all) or if the existing status doesn't match what it is supposed to be. Could the conditional and the comment be updated to make this more clear? 

Making helper methods with clear names would help a lot here, e.g.

if multiple_remotes? || remote_matches?