only call refresh_db and git-add-repository if repo is undefined
also strip trailing '/' in get_repo, see comment in code