Skip to content

Instantly share code, notes, and snippets.

@allen-ball
Last active Jul 27, 2021
Embed
What would you like to do?
# $Id: settings.py 8327 2021-07-27 18:22:02Z ball $
# https://github.com/joeyespo/grip
# Uses "git credential fill" to populate USERNAME and PASSWORD
def git_credential_fill():
import subprocess
argv = ["git", "credential", "fill"]
process = subprocess.Popen(argv, text = True, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
output = process.communicate(input = "protocol=https\nhost=github.com\n")[0].strip()
map = dict(item.split("=") for item in output.splitlines())
return (map["username"], map["password"])
(USERNAME, PASSWORD) = git_credential_fill()
@allen-ball

This comment has been minimized.

Copy link
Owner Author

@allen-ball allen-ball commented Jun 15, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment