gpt4 book ai didi

git - 在 Visual Studio 代码中设置 github 个人访问 token

转载 作者:行者123 更新时间:2023-12-04 17:15:22 26 4
gpt4 key购买 nike

我试图在 VS 代码中设置个人访问 token ,但它似乎不接受它。我把它放在命令面板的“Github:设置个人访问 token ”中,但它似乎没有任何效果。我还将 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

最佳答案

确保您拥有适用于 Windows 的最新 Git,以及 git config --global credential.helper设置为 manager-core .
从那里,使用 CMD (not git bash) 检查您确实将 token 作为密码存储在凭证助手中:

printf "protocol=https\nhost=github.com"|"C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager-core.exe" get
protocol=https
host=github.com
username=VonC
password=ghp_Dxc...<yourToken>
确保 token 以 ghp_ 开头(遵循 new token format update )。
如果没有,请删除它:
printf "protocol=https\nhost=github.com"|"C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager-core.exe" earase
然后下一次推送将询问并存储您的新凭据。
无需手动调整 Windows 凭据管理器:这就是这些助手的用途。
来自 the discussion ,问题是双重的:
  • System User Windows 路径未引用 Git 安装路径
  • 在本地存储库中注册的远程 URL 确实直接包含 token (而不是依赖 git 凭据管理器)

  • 解决这两个问题使 VSCode 开始使用正确的凭据进行推送。

    关于git - 在 Visual Studio 代码中设置 github 个人访问 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68785814/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com