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