Skip to content

Instantly share code, notes, and snippets.

@klmr
Created August 7, 2014 09:30
Show Gist options
  • Save klmr/3840aa3c12f947e4064c to your computer and use it in GitHub Desktop.
Save klmr/3840aa3c12f947e4064c to your computer and use it in GitHub Desktop.
Grip settings file for OS X, which retrieves the GitHub password from “Keychain Access.app”
def find_password():
import subprocess
import re
cmd = ['security', 'find-internet-password', '-gs', 'github.com']
pwinfo = subprocess.Popen(cmd, stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
pwline = pwinfo.stderr.read().strip()
return re.sub('password: "(.*)"', '\\1', pwline)
PASSWORD = find_password()
USERNAME = '<github_user_name>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment