Skip to content

Instantly share code, notes, and snippets.

@chasestubblefield
Last active December 8, 2017 23:25
Show Gist options
  • Save chasestubblefield/fd763fa98d4c2b1931c67ce2ca60e6a2 to your computer and use it in GitHub Desktop.
Save chasestubblefield/fd763fa98d4c2b1931c67ce2ca60e6a2 to your computer and use it in GitHub Desktop.
macOS keychain snippets

Adding GitHub password to login keychain for use with git-credential-osxkeychain:

security add-internet-password -a chasetopher -r htps -s github.com -T /Library/Developer/CommandLineTools/usr/libexec/git-core/git-credential-osxkeychain -w
security add-internet-password -a chasetopher -r htps -s gist.github.com -T /Library/Developer/CommandLineTools/usr/libexec/git-core/git-credential-osxkeychain -w

Due to what I think is a bug, add-internet-password sets partition list to apple-tool: instead of apple:. (Adding the password though Keychain Access.app results in apple:)

security set-internet-password-partition-list -a chasetopher -r htps -S apple:

Create new keychain: (will prompt for password) (Will be placed in ~/Library/Keychains/)

security create-keychain git.keychain

(Optional) Add keychain to search list: (makes keychain appear in security list-keychains and in Keychain Access.app)

security list-keychain -d user -s login.keychain git.keychain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment