我开始使用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/'

当前回答

尝试安装“Git凭证管理器For Windows”(并按照说明设置凭证管理器)。

当在应用程序中使用Git(例如Visual Studio Code)时,它将“神奇地”打开所需的对话框,用于Visual Studio Team Services凭据输入。

其他回答

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

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

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

Windows 10操作系统:进入控制面板→凭证管理器→Windows凭证→点击Git链接→编辑→更新新密码。这应该有用。

下面是我在电脑上解决这个问题的方法:

开放Visual Studio代码 进入菜单文件→首选项→设置 在User选项卡下,展开Extensions并选择Git 在右侧窗格中找到Autofetch并取消选中它

你应该能够像这样设置你的凭证:

git remote set-url origin https://<USERNAME>:<PASSWORD>@bitbucket.org/path/to/repo.git

你可以像这样获取远程URL:

git config --get remote.origin.url

我通常运行这个简单的命令来将Git远程URL从HTTPS更改为SSH:

git remote set-url origin git@github.com:username/repo-name-here.git