You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe it is a newbie question, but is there any method on GitPython that retrieves the configuration at levels system, global and local easily?
I am already using git.config(key) for local configuration, but I would like to know if there is any other way to get at all levels.
I have tried using GitConfigParser, but when I try to get user or user.name, for example, I get the error configparser.NoSectionError: No section: 'user.name'
What should work is to explicitly ask for a ConfigReader at from an existing git repository instance, like so: r = git.Repo(path).config_reader(). When that instance is asked for a value like so r.get_value('user', 'name') it would find the respective value in any of the layered configuration files, looking first in the repository configuration, then user, and then the system.
I hope that helps. Please note that I am closing this issue, yet you are free to keep posting here for follow-up questions or comments.
Activity
Byron commentedon Dec 29, 2019
What should work is to explicitly ask for a ConfigReader at from an existing git repository instance, like so:
r = git.Repo(path).config_reader(). When that instance is asked for a value like sor.get_value('user', 'name')it would find the respective value in any of the layered configuration files, looking first in the repository configuration, then user, and then the system.I hope that helps. Please note that I am closing this issue, yet you are free to keep posting here for follow-up questions or comments.