cleanup and prepare repository