Visual Studio Code始终要求提供git凭据 [英] Visual Studio Code always asking for git credentials

查看:2551
本文介绍了Visual Studio Code始终要求提供git凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用



我在弹出窗口中输入我的 GitHub 凭据,但在 Git 输出中仍然出现此错误 Visual Studio Code 中的窗口:

 远程:匿名访问ddieppa / LineOfBizApp.git被拒绝。 
致命:https://github.com/ddieppa/LineOfBizApp.git/'
认证失败


解决方案

我在 VSCode文档

a>:


提示:您应该设置一个证书助手,以避免每次VS Code与你的Git远程对话时都要求
。如果您的
不这样做,您可能需要考虑在...
菜单中禁用自动提取功能,以减少提示的数量。


因此,请打开凭证助手,以便Git将密码保存在内存中一段时间​​。默认情况下,Git会将您的密码缓存15分钟。



在终端中,输入以下内容:

  git config --global credential.helper cache 
#设置git使用凭证内存缓存

要更改默认密码缓存超时,请输入以下内容:

  git config --global credential.helper'cache --timeout = 3600'
#将缓存设置为在1小时后超时(设置以秒为单位)



UPDATE



我安装了VS Code和config,但是正如@ddieppa所说,它对我也不适用。所以我试图在用户设置中找到一个选项,并且我看到git.autofetch= true,现在设置为false! VS代码不再需要重复输入密码!



在菜单中,单击文件/首选项/用户设置
并键入以下内容:



将您的设置置于此文件中以覆盖默认设置

  {
git.autofetch:false
}


I started using Visual Studio Code, and I was trying to save my test project into GitHub, but Visual Studio Code is always asking for my GitHub credentials.

I have installed in my PC GitHub Desktop and also Git, I already ran:

 git config --global credential.helper wincred

but still Visual Studio Code is asking for the credentials.

Any help?

here is my .gitconfig file located in the user profile folfer:

    [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

Here is the popup windows asking for the credentials:

I enter my GitHub credentials in the popup, but still getting this error in the Git output window in Visual Studio Code:

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

解决方案

I found the solution on VSCode document:

Tip: You should set up a credential helper to avoid getting asked for credentials every time VS Code talks to your Git remotes. If you don't do this, you may want to consider Disabling Autofetch in the ... menu to reduce the number of prompts you get.

So, let turn on the credential helper so that Git will save your password in memory for some time. By default, Git will cache your password for 15 minutes.

In Terminal, enter the following:

git config --global credential.helper cache
# Set git to use the credential memory cache

To change the default password cache timeout, enter the following:

git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)

UPDATE

I installed VS Code and config same above, but as @ddieppa said, It didn't work for me too. So I tried to find an option in User Setting, and I saw "git.autofetch" = true, now set it's false! VS Code is no longer required to enter password repeatedly again!

In menu, click File / Preferences / User Setting And type these:

Place your settings in this file to overwrite the default settings

{
  "git.autofetch": false
}

这篇关于Visual Studio Code始终要求提供git凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆