向github提交代码git push报错: Support for password authentication was removed on August 13, 2021.

好久没有往github仓库中提交代码了 今天在github创建仓库后

  1. 提交报错:
Support for password authentication was removed on August 13, 2021.

官方给出的答案:
Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.

由于操作环境的问题, 我本文只介绍Mac下的操作步骤,windows linux的操作官网也有具体的步骤,除了安装GCM的方式不同以外,其他基本相同。附上官网链接

  1. mac 下载GCM ( Git Credential Manager)
    向github提交代码git push报错: Support for password authentication was removed on August 13, 2021._第1张图片

图中第三步输入 mac的用户登录密码
向github提交代码git push报错: Support for password authentication was removed on August 13, 2021._第2张图片

  1. github中创建个人访问令牌 (personal access token)
    步骤: 登录github -> 点击用户头像 下拉菜单中选择 Setting -> 右侧菜单中选择 Developer setting -> 右侧菜单中中选择 personal acccess token ->点击右上角 generate new token 按钮
    向github提交代码git push报错: Support for password authentication was removed on August 13, 2021._第3张图片
    向github提交代码git push报错: Support for password authentication was removed on August 13, 2021._第4张图片
    创建成功后 请及时复制出来 以便稍等使用(图中标注已说明:退出重进后,将无法查看)

  2. 在git bash中继续提交代码 此时就会出现一个回话弹框,
    向github提交代码git push报错: Support for password authentication was removed on August 13, 2021._第5张图片
    向github提交代码git push报错: Support for password authentication was removed on August 13, 2021._第6张图片
    此时需要校验身份,方式有两种,第二种就是使用我们刚才创建好的 复制出来的令牌 点击sign in 登录成功后代码就提交到github了

在访问令牌的有效期内 再次提交代码 就无需再次进行身份验证了 因为GCM已经缓存了你的令牌(personal access token)

你可能感兴趣的:(git,Mac,git,github)