Skip to content

Instantly share code, notes, and snippets.

@austinbrian
Created February 1, 2024 17:12
Show Gist options
  • Save austinbrian/c91fa9dbe34ea408fb5f7c6c17a88613 to your computer and use it in GitHub Desktop.
Save austinbrian/c91fa9dbe34ea408fb5f7c6c17a88613 to your computer and use it in GitHub Desktop.
Turn the values of git config into a python dict
import subprocess
# this should work in any directory, whether a git repo or not
git_dict = dict(
x.split('=')
for x in
subprocess.check_output(
['git','config','--list']
).decode('ascii').strip().split('\n'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment