哪里可以存储来自GitHub的个人访问令牌? [英] Where to store the personal access token from GitHub?

查看:401
本文介绍了哪里可以存储来自GitHub的个人访问令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在GitHub中生成个人访问令牌后,是否有必要将其存储在计算机上的本地位置?

Is it necessary to store the personal access token somewhere locally on the machine after generating it in GitHub?

如果是,是否有任何首选的方式可以存储它?

If yes, is there any preferred way where it could be stored?

推荐答案


半点密码是(理想情况下)您记住了密码并且系统对它们进行了哈希处理,因此它们永远不会以纯文本形式存储在任何地方。

GitHub的个人访问令牌系统似乎基本上迫使您将令牌存储为纯文本格式?

Half the point of passwords is that (ideally) you memorize them and the system hashes them, so therefore they're never stored anywhere in plain text.
Yet GitHub's personal access token system seems to basically force you to store the token in plain text?

首先,一个 PAT(个人访问令牌)并不简单密码,但等效于:

First, a PAT (Personal Access Token) is not a simple password, but an equivalent that:


  • 您可以生成多个时间(例如,每台计算机需要一个时间来访问GitHub存储库)

  • 您可以随时(从GitHub Web界面)撤消,即使该PAT在其中一台机器上徘徊,也可以使它过时。 / li>
  • you can generate multiple time (for instance, one per machine from which you need to access GitHub repository)
  • you can revoke at any time (from the GitHub web interface), which makes that PAT obsolete, even if it lingers around on one of those machines.

那是不同的密码,该密码对于您的帐户是唯一的,并且在您偶然使用它的任何地方都必须对其进行修改,因此无法轻松更改。

That differs from your password, which is unique to your account, and cannot be easily changed without having to also modify it everywhere you happen to use it.

由于在命令行或API上使用Git通过HTTPS执行Git操作时,可以用PAT代替密码,因此可以使用 git凭据帮助程序以安全地对其进行缓存。

例如,在Windows上,它会使用 Windows凭据管理器,通过 GCM-Git凭据管理器-Windows

Since a PAT can be used in place of a password when performing Git operations over HTTPS with Git on the command line or the API, you can use a git credential helper to cache it securely.
On Windows, for instance, that would use the Windows Credential Manager, through the GCM -- Git Credential Manager -- for Windows:

git config --global credential.helper manager

第一次执行回购操作时,会弹出一个询问输入您的凭据:用户名您的PAT。

下次,它不会询问,并直接重用已安全存储在您的凭据管理器中的PAT。

The first time you are pushing to a repo, a popup will ask for your credentials: username and your PAT.
The next time, it won't ask, and reuse directly that PAT, which remains stored securely in your Credential Manager.

类似的想法适用于使用OSX钥匙串的Mac ,和使用 GNOME密钥环

想法仍然存在:将PAT存储在经过加密的凭据存储。

A similar idea applies for Mac with the OSX keychain, and Linux with the GNOME Keyring.
The idea remains: store the PAT in an encrypted credentials store.

这篇关于哪里可以存储来自GitHub的个人访问令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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