Git推送到GitHub仓库遇到的问题

问题一

问题:

GitHub 从 2021 年 8 月 13 日起,就不再支持使用账号密码进行 Git 操作了,必须使用个人访问令牌(Personal Access Token, PAT)来代替

类似报错如下:

19:43:23.011: [first_item] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/master:refs/heads/master --set-upstream

remote: Invalid username or token. Password authentication is not supported for Git operations.

fatal: Authentication failed for 'https://github.com/jige4836/Pet-System.git/'

Token生成步骤

1.点击头像

2.选择Settings

进入Settings后,滑动左侧边栏到底部,点击Developer settings

1.确保进入Developer settings

2.点击Personal access tokens

注:操作过程中,需要进行验证,可以使用GitHub手机App验证

1.点击tokens(classis)

2.点击Generate new token

3.选择第二个Generate new token(classis)

1.名称Note

2.有效期限Expiration(可以以月为单位,但是别设置太长时间)

3.仓库权限repo(建议授予仓库所有权限)

提交后就可以看到tokens,复制后可以直接当密码用

退出后,就会显示token,可以点击查看详情

未完待续~~~

相关推荐
shandianchengzi11 小时前
【记录】Copilot|Github Copilot重新学生认证通过方法(2025年7月,包括2FA和认证材料、Why are you not on campus)
github·copilot
K1ne_11 小时前
2026 最新版|学生认证白嫖 GitHub Copilot Pro 保姆级教程
github·copilot
cs.shunzhang11 小时前
GitHub 教育认证通过后如何领取 Copilot Pro
github·copilot
程序员柒叔11 小时前
OpenCode 踩坑记:GitHub Copilot 按次计费?我的账单为何暴涨 3 倍!
github·copilot·claude code·opencode
刚刚觉醒的小菜鸡11 小时前
copilot学生认证2026-github copilot学生认证(手把手教会)
github·copilot
徐小夕12 小时前
我花一天时间Vibe Coding的开源AI工具,一键检测你的电脑能跑哪些AI大模型
前端·javascript·github
一乐小哥18 小时前
如何写一个好的 Pull Request
github
Hommy8818 小时前
【开源剪映小助手】云渲染环境搭建
python·开源·github·剪映小助手
Robot_Nav19 小时前
Git 项目维护命令指南相关讲解
git·机器人·github