2024 07 18 2024 07 18 今日內容
2024-07-18-今日內容
# 2024-07-18-vscode GitHub 账号登不上,或者push不了的问题
🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️下一個筆記🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️🐿️
2024-07-18-vscode GitHub 账号登不上,或者push不了的问题
layout: post title: ‘vscode GitHub 账号登不上,或者push不了的问题’ date: 2024-07-18T13:10:30-04:00
由于你在推送代码时没有机会输入 Personal Access Token (PAT),可能是因为 Git 缓存了旧的凭据。你可以尝试以下步骤来清除旧的凭据并重新配置。
1. 清除存储的旧凭据
你可以通过以下命令来清除 Git 的凭据缓存:
git credential-cache exit
2. 删除 Git 凭据管理器中的旧凭据
如果你使用了 Git 凭据管理器(Credential Manager),你需要删除其中存储的旧凭据。
在 macOS 上删除凭据
- 打开
钥匙串访问(Keychain Access)。 - 在左侧选择
登录钥匙串和密码类别。 - 搜索
github.com。 - 删除与 GitHub 相关的所有条目。
3. 设置新的远程仓库 URL 并推送代码
确保远程仓库 URL 设置正确,然后重新推送代码。
- 设置远程仓库 URL:
git remote set-url origin https://github.com/Jynxzzz/Udemy-Courses.git - 推送代码到远程仓库:
git push -u origin main - 当系统提示输入用户名和密码时:
- 在用户名字段中输入你的 GitHub 用户名。
- 在密码字段中粘贴你的 PAT。
4. 强制要求输入凭据
你可以通过以下命令强制要求 Git 重新输入凭据:
git config --global credential.helper ""
示例操作步骤
- 清除旧凭据缓存:
git credential-cache exit - 删除钥匙串访问中的旧凭据。
- 打开
钥匙串访问,删除与github.com相关的条目。
- 打开
- 强制 Git 重新输入凭据:
git config --global credential.helper "" - 设置远程仓库 URL:
git remote set-url origin https://github.com/Jynxzzz/Udemy-Courses.git - 推送代码:
git push -u origin main - 输入用户名和 PAT:
- 用户名:你的 GitHub 用户名
- 密码:你的 PAT
通过这些步骤,你应该能够清除旧的凭据并重新配置新的 PAT,从而成功推送代码到 GitHub。如果仍然有问题,请告诉我。
Shortcuts for Next Step:
- input “1” for 配置 GitHub SSH key 以避免每次推送时输入密码
- input “2” for 创建和管理 GitHub 分支
- input “3” for 在 VSCode 中设置自动化脚本以简化工作流
Or, you can just type “continue” or “c”, I will continue automaticlly.
#github #vscode #push #匯總今日內容