Updated the script to be inteligently recognize remote repo