【问题标题】:Update personal token for github更新 github 的个人令牌
【发布时间】:2022-01-22 10:46:31
【问题描述】:

我的 GitHub 个人访问令牌已过期,我实在不知道如何在命令行上更新个人访问令牌。

git push
Password for 'https://PERSONAL_ACCESS_TIME@github.com': 
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/
for more information.
fatal: Authentication failed for 'https://github.com/myuser/myrepor.git/'

任何帮助将不胜感激,因为我很困惑

【问题讨论】:

  • 您是否阅读了docs.github.com/en/authentication/… 的说明?你在哪里卡住了?
  • 我已阅读 github 文档,URL 包含旧令牌,我不知道如何更新它
  • 所以你的问题是关于找到令牌保存的位置,而不是重新生成它?

标签: git github


【解决方案1】:

您不应将令牌保存在 URL 中。这是不安全的,因为任何可以读取配置文件的人都可以看到您的凭据。 Git FAQ explains how to set up and use a credential helper

要从您的 URL 中删除令牌,请执行以下操作:

$ git remote set-url origin https://github.com/myuser/myrepor.git

然后,在设置好凭证助手后,当您推送时,Git 会提示您输入凭证。出现提示时输入您的用户名,并在提示输入密码时提供令牌。

【讨论】:

    猜你喜欢
    • 2021-10-19
    • 1970-01-01
    • 2021-12-12
    • 2023-01-28
    • 2021-09-04
    • 2022-11-02
    • 2023-04-01
    • 2021-10-19
    • 2021-10-16
    相关资源
    最近更新 更多