GitPython Table of Contents Get the root(toplevel) of the git repository Get the root(toplevel) of the git repository howto from git import Repo repo = Repo('.', search_parent_directories=True) print(repo.working_tree_dir) /Users/yeonghoey/yeonghoey https://stackoverflow.com/questions/22081209/find-the-root-of-the-git-repository-where-the-file-lives https://gitpython.readthedocs.io/en/stable/reference.html#git.repo.base.Repo