46

This is new machine with fresh install of Git.

> git --version
git version 2.19.1.windows.1

I cloned repo using https. Every time when I try to talk to remote I get this.

> git pull
fatal: NullReferenceException encountered.
Object reference not set to an instance of an object.
fatal: NullReferenceException encountered.
Object reference not set to an instance of an object.

I tried uninstalling and installing git again. I also cloned same repo to different directory on disk but none of this helped.

When I go to web UI of my BitBucket, there is 2FA enabled. I don't know if this has anything to do with my problem.

0

3 Answers 3

70

The reason for this is that the Git Credential Manager (GCM) that is distributed with Git 2.19.1 needs to be updated.

The release of Git 2.19.1 says:

Comes with Git Credential Manager v1.18.0.

And when we look at GCM 1.18.1 (the next version) release notes:

Fixes Null Reference exceptions when parameters or contentType are not populated

(Edit 23. Nov 2018): As @pgsandstrom says in the comment, Git has released a new version that also contains a newer GCM. You can download it here: Git Releases.


(Rest is old version before 23. Nov 2018))

The interim fix, until Git releases a new version with the updated GCM is to simply install the new version of Git Credential Manager yourself.

So go download the latest version from here and install it and it should fix your issues.


Note that it is not clear to me whether this is a fault introduced by Git (ie. it fails to populate the parameter or contentType), or that it is a fault introduced by GCM. All I know is that Git has not released a new version that fixes the issue but GCM has.

4
  • I chose the wrong account at the first prompt and was never able to recover until I found this post. Not sure if that was the root cause or not but in case it helps someone else. Commented Nov 11, 2018 at 2:37
  • It is now sufficient to only update Git, as a version with newer version of GCM has been released. Commented Nov 22, 2018 at 9:05
  • 1
    @pgsandstrom Nice, thanks, update-time then :) Also edited the answer. Commented Nov 23, 2018 at 7:28
  • Spot on, was annoying me for days. Upgraded to: git version 2.19.2.windows.1
    – GBGOLC
    Commented Dec 6, 2018 at 23:12
3

I'm running the newest git version 2.19.1.windows.1 installed via Scoop.

We have migrated repository from GitLab to BitBucket, then I've got the same message:

fatal: NullReferenceException encountered. Object reference not set to an instance of an object.

What solved the problem was this command:

git config --global credential.helper wincred
0
0

One of the reasons for this could be password changes for git(and other similar version control systems).

I can recommend a couple of solutions

  1. As mentioned by @mpro, you will be asking to use the credentials stored on the windows credential manager. You would like to update your password accordingly there.

    The way you can reach that point is(in WIN 10): Start -> Control Panel -> Control Panel -> Credential Manager

  2. On the contrary you can ask git to use credentials from its cache by using the following command

    git config --global credential.helper cache

    By doing this, git will prompt for the username and password at each interaction with the remote origin.

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.