[英]Update personal token for github
我的 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/'
任何幫助將不勝感激,因為我很困惑
您不應將令牌保存在 URL 中。 這是不安全的,因為任何可以讀取配置文件的人都可以看到您的憑據。 Git 常見問題解答說明了如何設置和使用憑證助手。
要從 URL 中刪除令牌,請執行以下操作:
$ git remote set-url origin https://github.com/myuser/myrepor.git
然后,在設置好憑證助手后,當您推送時,Git 會提示您輸入憑證。 出現提示時輸入您的用戶名,並在提示輸入密碼時提供令牌。
您可以使用 github 命令行使用新/重新生成的令牌進行新登錄
安裝 github CLI:
brew install gh
登錄到gh:
gh auth login
按照本教程的步驟操作並在需要時粘貼您的令牌
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.