git - Github 个人访问令牌
问题描述
我刚刚发现,从 13 日起,对密码身份验证的支持已被删除,而我应该使用个人访问令牌。我生成了令牌并按照终端中提供的链接中的步骤操作,但是当我尝试推送时它仍然给我一些问题。有谁知道为什么?
[kinzluiz:...ch-7-object-oriented-design]$ git status (main✱)
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: louis/.classpath
new file: louis/.gitignore
new file: louis/.project
new file: louis/src/deckofcards/BlackJack.java
new file: louis/src/deckofcards/Card.java
new file: louis/src/deckofcards/Deck.java
new file: louis/src/deckofcards/Suit.java
new file: louis/src/module-info.java
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: ../ch2-linked-lists/Louis/linkedlistctci.py
deleted: ../ch2-linked-lists/Louis/main.py
modified: ../ch3-stacks-and-queues/louis/main.py
Untracked files:
(use "git add <file>..." to include in what will be committed)
../ch1-arraysAndStrings/Louis/.gitignore
../ch3-stacks-and-queues/.idea/
[kinzluiz:...ch-7-object-oriented-design]$ git commit -m "deck of cards " (main✱)
[main e6676a6] deck of cards
8 files changed, 103 insertions(+)
create mode 100644 ch-7-object-oriented-design/louis/.classpath
create mode 100644 ch-7-object-oriented-design/louis/.gitignore
create mode 100644 ch-7-object-oriented-design/louis/.project
create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/BlackJack.java
create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/Card.java
create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/Deck.java
create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/Suit.java
create mode 100644 ch-7-object-oriented-design/louis/src/module-info.java
[kinzluiz:...ch-7-object-oriented-design]$ git push (main✱)
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: unable to access 'https://github.com/AisosaUtieyin/ctci.git/': The requested URL returned error: 403
解决方案
这可能意味着您的旧凭证(密码)仍存储在 Git 凭证助手中。
检查输出git config --global credential.helper
:它可能缓存了另一个用户/电子邮件/密码。
如果该设置为xxx
,请键入:
printf "protocol=https\nhost=github.com"| git-credential-xxx get
' xxx
',我的意思是“的输出git config --global credential.helper
”。
不要使用' xxx
':替换它。
您将检查是否已存储任何凭据。
如果是:
printf "protocol=https\nhost=github.com"| git-credential-xxx erase
下一次推送将提示您输入新凭据(令牌)。
例如,如果输出为:osxkeychain
,请键入(仅限 Mac):
printf "protocol=https\nhost=github.com"| git-credential-osxkeychain erase
# Or:
security delete-internet-password -l github.com
这两个命令都从您的KeyChain中删除该github.com
条目。
推荐阅读
- python - 步骤功能:批处理总是在异常抛出时返回 State.TaskFailed 错误
- javascript - 如何从 Crome Network 获取数据
- r - 如何创建一个组合不同变量 (R) 的所有值的数据框?
- python - 找到从 A 到 B 并经过 C 的圆形路径
- jquery - 如何在数据库中存储 jQuery 对象的唯一记录以供以后检索和交互?
- flutter - 参数类型'Iterable
>' 不能分配给参数类型 'List ' - c# - Entity Framework 6 - 是否可以仅为特定的 dbContext 添加命令拦截器
- php - 贝宝支付集成
- reactjs - GeoIPify 和 React-leaflet 无法获取纬度和经度
- selenoid - 如何通过配置管理器在 selenoid ui 中设置 selenoid 地址