update or clone depending on whether directory exists