lib/learn_submit/submission/git_interactor.rb in learn-submit-1.0.1 vs lib/learn_submit/submission/git_interactor.rb in learn-submit-1.0.2
- old
+ new
@@ -67,10 +67,17 @@
remove_old_remote
add_correct_remote
end
def add_backup_remote
- git.add_remote("#{old_remote_name}-bak", old_url)
+ begin
+ git.add_remote("#{old_remote_name}-bak", old_url)
+ rescue Git::GitExecuteError => e
+ if e.message.match(/already exists/).nil?
+ puts "Sorry, something Git-related went wrong. Please try again."
+ exit
+ end
+ end
end
def remove_old_remote
git.remote(old_remote_name).remove
end