Make repo.commit method safe