github、gist push密码验证错误记录

前景问题提要:
git push 时报错:remote: Support for password authentication was removed . 完整错误如下:

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://gist.github.com/2df442f4031c39744a6fa71470d97f0a.git/'

网上解决方法挺多的,我的解决方法:

  • 一些git命令
git config -l # 查看git配置信息
git remote show  # 列出remote name
git remote show [remote-name] # 查看某个remote的远程仓库信息
  • 问题1:remote: Repository not found.
remote: Repository not found.
fatal: repository 'https://github.com/MyRepo/project.git/' not found

解决方法:

# Step1: 修改git仓库配置
git remote show # 查看远程仓库
git remote show origin # 查看url是否配置正确,最好使用下面的 `git remote add...`格式配置
git remote remove origin # 按上2句命令列出的仓库名,删除
git remote add origin https://[personal-access-token]@github.com/username/repo_name.git # 重新添加远程仓库。

# Step2: push / pull,以pull 举例
git push --set-upstream origin master # 此时若需password,输入token即可

# Step3: 配置到计算机缓存。由于后面打开github网页密码不可见,现在配置到计算机缓存中
# 将给定的记录缓存到你的计算机中,以记住令牌:
git config --global credential.helper cache # 再使用`git config -l` 看是否保存成功
# 如果想要删除缓存记录:
git config --global --unset credential.helper
git config --system --unset credential.helper

注意:
我之前生成过一次 personal token,按照上面配置仍旧有误,重新生成personal token后,成功。
生成personal token 官方博客:

其余的问题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值