config.py 332 B

123456789101112131415
  1. #!/usr/bin/python
  2. # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
  3. # Read the config file for a git repository.
  4. #
  5. # Example usage:
  6. # python examples/config.py
  7. from dulwich.repo import Repo
  8. repo = Repo(".")
  9. config = repo.get_config()
  10. print(config.get("core", "filemode"))
  11. print(config.get(("remote", "origin"), "url"))