GitHub不再支持密码验证解决方案:SSH免密与Token登录配置

简介: 今天提交代码,push到GitHub上,突然出现这个问题。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 acce

今天提交代码,push到GitHub上,突然出现这个问题。

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/zhoulujun/algorithm.git/': The requested URL returned error: 403

官方的解释:https://github.blog/changelog/2021-08-12-git-password-authentication-is-shutting-down/

As previously announced, starting on August 13, 2021, at 09:00 PST, we will no longer accept account passwords when authenticating Git operations on GitHub.com. Instead, token-based authentication (for example, personal access, OAuth, SSH Key, or GitHub App installation token) will be required for all authenticated Git operations.

Please refer to this blog post for instructions on what you need to do to continue using git operations securely.

Removal

August 13, 2021, at 09:00 PST

大致意思是,密码验证于2021年8月13日不再支持,也就是今天intellij不能再用密码方式去提交代码。请用使用 personal access token 替代。

这个去年年底就说了,https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

In July 2020, we announced our intent to require the use of token-based authentication (for example, a personal access, OAuth, or GitHub App installation token) for all authenticated Git operations. Beginning August 13, 2021, we will no longer accept account passwords when authenticating Git operations on GitHub.com.

自己鼓捣了一遍 Token,烦人的很。还是觉得直接ssh 的方式操作git就好(之前是ssh的源,也没有这个问题)。

github配置SSH免密登录

这里讲的是Mac OS 操作。windows可以借鉴

查看ssh目录

ls -al ~/.ssh

Mac OS目录~/.ssh,windows目录是: Users/uestc/.ssh/id_rsa

-如果有配过,会列出:

  • id_rsa (私钥)——这个不能泄露
  • id_rsa.pub(公钥)

-如果没有配过,那么就进入第二步

新建一个新的SSH KEY

ssh-keygen -t rsa -b 4096 -C "uestchan@sina.com"

接着会提示这个公钥私钥的保存路径-建议直接回车就好(默认目录里)

接着提示输入私钥密码passphrase - 如果不想使用私钥登录的话,私钥密码为空,直接回车

生成成功后,把 id_rsa.pub 拷贝到 github 新建的 SSH keys 中

配置好好,记住,你项目得使用 SSH clone

如果本地是https 源,那么就修改git 仓库地址

git修改远程仓库地址

方法有三种:

  1. 1.修改命令
  2. git remote origin set-url [url]
  3. 先删后加
  4. git remote rm origin
  5. git remote add origin [url]
  6. 直接修改config文件
  7. git文件夹,找到config,编辑,把就的项目地址替换成新的。

顺手安利下 《git宝典—应付日常工作使用足够的指北手册》

关于github 建议让换 Token的形势,操作如下

GitHub token

打开自己的GitHub主页,点击自己的头像找到Settings并进入,在左边目录栏找到Personal access tokens,点击Generate new token,按照步骤申请即可,过程简单。Scopes(范围)那里建议全选。

Token申请成功后,将Token复制到Token一栏中

操作路径:

生成新的token就好。权限我是全部勾选上的。

Intellij IDEA 上Github账号校验

配置Git路径

打开Settings(File-->Settings) --> 在搜索栏内输入git,回车跳转到Git配置页面 --> 将git的运行路径填入Path to Git executable一栏(一般IDEA会自动定位)

配置GitHub账户密码

第一种方法可以选择使用帐号密码认证(Password)

之前的老板是这样的

在Login一栏填入你GitHub的用户名 --> Password那栏填入你GitHub的登录密码

现在新版本的,点击密码登录,会自动跳转到登录验证页面,在验证页面点击确定(我的密码是chrome记住的)。就自动登录

选择log width token,填入token就好

参考文章:

github配置SSH免密登录 https://blog.csdn.net/qq_38163309/article/details/105335097

GIT免密登录神器 SSH KEY配置详解 https://blog.csdn.net/w15321271041/article/details/80535135

Intellij IDEA 使用GitHub+Git https://www.cnblogs.com/yysbolg/p/8566389.html

Intellij IDEA 协同 Git 与 GitHub 进行开发使用 https://www.jianshu.com/p/ea1703adf5cc

Github 生成token的方法 — IDEA 拉代码或push失败需要从新校验Token https://blog.csdn.net/SR02020/article/details/106882205

Intellij IDEA 协同 Git 与 GitHub 进行开发使用 https://www.jianshu.com/p/ea1703adf5cc


本文就是愿天堂没有BUG给大家分享的内容,大家有收获的话可以分享下,想学习更多的话可以到微信公众号里找我,我等你哦。

相关文章
|
2月前
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
105 10
|
3月前
|
安全 网络安全 数据安全/隐私保护
Debian 12系统中允许Root远程SSH登录解决方法!
在 Debian 12 系统中开启 SSH 远程 Root 登录需修改 SSH 配置文件 (`sshd_config`),将 `PermitRootLogin` 设置为 `yes` 并确保密码认证启用。完成后重启 SSH 服务并验证连接。若防火墙启用,需放行端口 22。注意,直接开放 Root 登录可能带来安全风险,建议使用普通用户登录后切换至 Root。
266 1
|
5月前
|
Devops Shell 网络安全
git使用之如何将一套代码同时推送至github|gitee|gitcode|gitlab等多个仓库-含添加ssh-优雅草央千澈完美解决-提供整体提交代码
git使用之如何将一套代码同时推送至github|gitee|gitcode|gitlab等多个仓库-含添加ssh-优雅草央千澈完美解决-提供整体提交代码
247 16
git使用之如何将一套代码同时推送至github|gitee|gitcode|gitlab等多个仓库-含添加ssh-优雅草央千澈完美解决-提供整体提交代码
|
10月前
|
JavaScript 应用服务中间件 Linux
【应用服务 App Service】解决无法从Azure门户SSH登录问题
【应用服务 App Service】解决无法从Azure门户SSH登录问题
134 0
|
6月前
|
监控 Ubuntu 安全
debian或Ubuntu中开启ssh允许root远程ssh登录的方法
在Debian或Ubuntu系统中启用root用户的SSH远程登录需要编辑SSH配置文件、设置root密码并重启SSH服务。虽然这可以在某些情况下提供便利,但必须注意安全性,通过使用强密码、限制IP访问、使用SSH密钥认证等方法来保护服务器的安全。
2721 5
|
10月前
|
安全 网络协议 Shell
Github代码仓库SSH配置流程
这篇文章是关于如何配置SSH以安全地连接到GitHub代码仓库的详细指南,包括使用一键脚本简化配置过程、生成SSH密钥对、添加密钥到SSH代理、将公钥添加到GitHub账户以及测试SSH连接的步骤。
311 0
Github代码仓库SSH配置流程
|
8月前
|
数据安全/隐私保护
github报错(完美解决):获取token。remote: Support for password authentication was removed on August 13, 2021.
这篇文章介绍了如何在GitHub上解决因密码认证被移除而导致的推送错误,通过创建和使用个人访问令牌(token)来代替密码进行身份验证。
1629 0
|
10月前
|
机器学习/深度学习 存储 Linux
【机器学习 Azure Machine Learning】使用VS Code登录到Linux VM上 (Remote-SSH), 及可直接通过VS Code编辑VM中的文件
【机器学习 Azure Machine Learning】使用VS Code登录到Linux VM上 (Remote-SSH), 及可直接通过VS Code编辑VM中的文件
123 4
|
10月前
|
监控 安全 Ubuntu
在Linux中,如何进行SSH服务配置?
在Linux中,如何进行SSH服务配置?
|
10月前
|
安全 Shell Linux
如何禁止某个用户使用ssh登录
本文介绍了五种禁止用户通过SSH登录的方法:1) 修改`/etc/ssh/sshd_config`文件中的`DenyUsers`和`DenyGroups`来阻止特定用户或用户组登录;2) 将用户的默认shell设置为`/usr/sbin/nologin`或`/bin/false`以禁用其SSH访问;3) 利用PAM(可插入认证模块)通过编辑`/etc/security/sshd.conf`来限制登录权限;4) 通过编辑`/etc/hosts.deny`文件拒绝特定用户的SSH访问;5) 锁定或禁用用户账号以阻止所有类型的登录。每种方法都提供了详细的步骤指导。
1279 1