extract _get_repo_instance() method