Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store your github https password on Linux in a terminal keychain?

This is becoming even more important now with the new 2-factor authentication, as one has to create a new token each time a password is required on the terminal. Basically, I'm looking for an equvalent to the osxkeychain available in OS X that I could use on Linux desktops and servers:

git config --global credential.helper osxkeychain

I searched through the possible solutions, but so far I don't like any of them:

  • ssh instead of https - not recommended and links not easily accessible on GitHub
  • cache --timeout=3600 - it will expire eventually and reentering the password is a drag with the new 2FA
  • gnome-keyring - doesn't work on a headless server (at least not too elegantly - the ssh passphrase keyring is much nicer)
  • the encrypted .netrc file on my hard-drive method - poor man's manual keyring implementation?

Come on, there's got to be some proper terminal-based keychain for Linux that can be hooked to git's credential.helper!

like image 534
metakermit Avatar asked Sep 16 '13 22:09

metakermit


1 Answers

I would still recommend the method I describe in "Is there a way to skip password typing when using https://github.com"

Encrypting your .netrc allows you to store multiple credentials (to GitHub, and BitBicket, and ...) in one file, and have it used through the git credential helper netrc (git1.8.3+).

And it is compatible with the Github two-factor authentication, as I detail in "Configure Git clients, like GitHub for Windows, to not ask for authentication".

It works on Windows (and Linux or Mac).
And you can limit the number of minutes/hours during which gpg won't ask you again for the private key passphrase.

like image 111
VonC Avatar answered Sep 29 '22 20:09

VonC