github新规 取消密码认证解决方案


环境:

系统: window 10 pro

git: version 2.23.0.windows.1

terminal: Windows PowerShell

步骤:

1. github个人主页里生成token

Setting / Developer settings / Personal access tokens

点击生成token,如下图

拉到最下面点击生成即可

生成后记得保存好token,这个token在github中只能查看一次。

3. git 拉取代码或修改已拉取代码范例:

clone:

git clone https://[你的token]@[你的项目路径]
----
例:
git clone https://ghp_GW2bxXRpro0DEehtIDqF5wfvCFqTCi2xxxx@github.com/bingco-zhan/notes.git

本地已存在项目:

git remote set-url origin https://[你的token]@[你的项目路径]
----
例:
git remote set-url origin https://ghp_GW2bxXRpro0DEehtIDqF5wfvCFqTCi2xxxx@github.com/bingco-zhan/notes.git

git pull origin main

---------------------------------

当然了,将token当做密码使用也是没有问题的。只是输入略麻烦

Git