我开始使用Visual Studio Code,我试图将我的测试项目保存到GitHub,但Visual Studio Code总是要求我的GitHub凭据。

我已经在我的PC上安装了GitHub Desktop和Git。我已经跑了:

 git config --global credential.helper wincred

但是Visual Studio Code仍然在要求凭证。

我该如何解决这个问题?

下面是我的.gitconfig文件,位于用户配置文件文件夹中:

    [filter "lfs"]
    clean = git-lfs clean %f
    smudge = git-lfs smudge %f
    required = true
[user]
    name = ddieppa
[user]
    email = fake@live.com
[credential]
    helper = wincred

下面是弹出窗口要求凭据:

我在弹出窗口中输入了我的GitHub凭证,但仍然在Visual Studio Code中的Git输出窗口中得到这个错误:

remote: Anonymous access to ddieppa/LineOfBizApp.git denied.
fatal: Authentication failed for 'https://github.com/ddieppa/LineOfBizApp.git/'

当前回答

我在Visual Studio Code中遇到了类似的问题。

我通过将远程URL更改为https(在文件.git/config中)解决了这个问题:

[remote "origin"]
    url = https://user@server.com/plesk-git/project.git

还有:

git config --global credential.helper wincred

我又拉了一次,弹出了Windows凭据,问题解决了。

其他回答

我用简单的方法解决了一个类似的问题:

进入CMD或终端 输入git拉origin master。将“origin”替换为远程名称 它会要求提供证书。类型。

这是所有。我解决了这个问题。

请按照以下步骤进行处理。

卸载Visual Studio Code和Git软件,然后重新安装。将Git存储库克隆URL从SSH更改为HTTPS。

如果你是在Windows电脑上,那么安装Git for Windows。就是这样!

我设法通过执行以下步骤来阻止这种情况。

卸载GitHub Desktop(我不确定这是必要的) 卸载凭证管理器:cd“C:\Program Files\Git\mingw64\libexec\ Git -core”,然后执行Git - Credentials - Manager .exe卸载 重置凭证帮助使用wincred: git config——global credential。辅助wincred 使用Visual Studio Code来推动一些更改并重新输入凭证。

注意:我使用个人访问令牌作为密码。

这对我很有用。你只需要输入一次PAT。 Git配置——全局凭据。辅助wincred