如何在Linux终端钥匙串中存储您的github https密码? [英] How to store your github https password on Linux in a terminal keychain?

查看:435
本文介绍了如何在Linux终端钥匙串中存储您的github https密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,随着新的双因素身份验证,这一点变得更加重要,因为每次终端上需要密码时,必须创建一个新的令牌。基本上,我正在寻找与OS X中可用的osxkeychain等价的方法,我可以在Linux桌面和服务器上使用这些方法:

  git config --global credential.helper osxkeychain 

我搜索了可能的解决方案,但到目前为止我不不喜欢其中的任何一个:




  • ssh而不是https - 不推荐和GitHub上不易访问的链接

  • cache --timeout = 3600 - 它将最终过期,重新输入密码是一个拖动新的2FA

  • gnome-keyring - 无法在无头服务器上运行至少不太优雅 - ssh passphrase keyrin g更好)

  • 我的硬盘驱动器方法中加密的.netrc文件 - 穷人的手动密钥环实现?



接下来,必须有一些适合Linux的基于终端的keychain,它可以连接到git的credential.helper!

解决方案

我仍会推荐我在中描述的方法,在使用<$ c时有没有办法跳过密码输入$ c> https://github.com



加密您的 .netrc 允许你在一个文件中存储多个证书(到GitHub和BitBicket,...),并通过git凭证助手 netrc (git1.8.3 +)。

它与Github双因素认证兼容,详见配置Git客户端,例如Windows的GitHub,不要求认证



它适用于Windows(和Linux或Mac)。

您可以限制gpg不会询问的分钟数/小时数你再次使用私钥密码。


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!

解决方案

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.

这篇关于如何在Linux终端钥匙串中存储您的github https密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆