Search code examples
gitbitbucketfiddler

Is it normal for git-remote-http.exe to receive two 401 responses before getting a 200


I'm troubleshooting what seems to be a credentials issue with git communicating with the remote (very similar to this, but none of the answers fix my issue).

After setting git to proxy through fiddler I see that each execution of git pull results in 3 https requests after the connect.

enter image description here

  • request 1 has no auth header
  • request 2 has an auth header with no password
  • request 3 has an auth header and the password is applied correctly

Is this normal? If so, why?


Solution

  • Usually Git does not perform two requests that get a 401 response before getting a 200, unless it is using the Negotiate scheme with NTLM or Kerberos. Those protocols require multiple round trips to pass the authentication along.

    It's possible you have a credential helper that is passing along an empty password or some other invalid data. You can try to query it by doing something like this:

    $ echo url=https://server.example.com/owner/name.git | git credential fill
    

    That should show you what Git is getting as far as credentials. If Git gets both a valid username and password, it will not make a request with only a username.

    If you need to remove credentials from the credential manager, there's a Git FAQ entry that tells you how to do that. Git Credential Manager for Windows is broken and doesn't remove credentials properly, so if you're using it, you have to remove credentials by hand.