Home > Back-end >  Git: warning: auto-detection of host provider took too long (>2000ms)
Git: warning: auto-detection of host provider took too long (>2000ms)

Time:01-07

I tried this command: git remote prune origin

But I get this warning message and nothing is executed:

warning: auto-detection of host provider took too long (>2000ms)

warning: see https://aka.ms/gcm/autodetect for more information.

Any idea how to solve this ?

CodePudding user response:

You're using Git Credential Manager or Git Credential Manager Core, which is usually shipped with Git for Windows, but may be installed on multiple platforms. Most credential managers just prompt you for the username and password or token, but GCM and GCM Core will actually instead allow you to log in with your normal credentials for your host (plus a two-factor code, if necessary) and issue any relevant token for you instead of requiring you to issue one manually. This can make the experience better if you're using one of the most popular types of hosting sites (GitHub, GitLab, Bitbucket, or Azure DevOps).

However, in order to do so, GCM needs to know what platform you're using, and in this case, it timed out. If you already had a credential saved, this probably wouldn't matter, but it does in this case. GCM has a timeout so that things typically don't hang here if there's a network problem. You should set the provider using the configuration option mentioned in that link so that it knows what platform you're using and can perform authentication successfully for you.

If you do that and it continues to hang, you can switch credential helpers by unsetting the credential.helper value and then setting it instead to a different option. The Git FAQ list some common ones based on your platform. Note that in such a case, you will likely have to issue a personal access token or other token yourself and enter it when prompted for the password, since most hosting sites no longer permit a password for Git access.

  •  Tags:  
  • git
  • Related