我试图在VS代码中设置个人访问令牌,但它似乎不接受它。我把它放在命令调色板中的"Github: Set Personal Access Token“中,但它似乎没有任何效果。我还将令牌放在Windows凭据管理器中。
当我试图推的时候,我得到了这个错误:
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://<usr>:token@github.com/<us>/repository.git/': The requested URL returned error: 403发布于 2021-11-24 14:55:28
克隆库太多了吗?
全局存储令牌将很容易使用。
如果您的机器上有大量的克隆存储库,我认为最好的方法是在git credential.helper中存储Github令牌。
假设您手头有一个令牌,并且试图运行任何需要身份验证的git命令,即使在VSCode中,步骤如下:
命令到步骤3:
git config --global credential.helper cache若要从本地计算机清除令牌:
git config --global --unset credential.helper凭据缓存与令牌存储的时间有关。要控制这一次,必须设置“超时值”参数或更改策略,通过将“缓存”更改为“存储”来永久存储凭据,如下所示:
补足命令到步骤3(超时以秒为单位):
# timeout default is 900 seconds
git config --global --set credential.helper 'cache --timeout=3600'命令到步骤3(永久存储):
git config --global credential.helper store使用此助手的将在磁盘上存储未加密的密码/令牌,仅受文件系统权限的保护。
有用的参考资料:
https://stackoverflow.com/questions/68785814
复制相似问题