Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: NullReferenceException encountered when interacting with remote

Tags:

git

bitbucket

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.

like image 272
Piotr Perak Avatar asked Nov 05 '18 08:11

Piotr Perak


People also ask

How do I fix this error system NullReferenceException object reference not set to an instance of an object?

The best way to avoid the "NullReferenceException: Object reference not set to an instance of an object” error is to check the values of all variables while coding. You can also use a simple if-else statement to check for null values, such as if (numbers!= null) to avoid this exception.

What does system NullReferenceException mean?

NullReferenceException: Object reference not set to an instance of an object. This exception is thrown when you try to access any properties / methods/ indexes on a type of object which points to null.

How do I fix NullReferenceException in C #?

You can eliminate the exception by declaring the number of elements in the array before initializing it, as the following example does. For more information on declaring and initializing arrays, see Arrays and Arrays. You get a null return value from a method, and then call a method on the returned type.

How do you fix fatal could not read from remote repository please make sure you have the correct access rights and the repository exists?

The Git “fatal: Could not read from remote repository” error occurs when there is an issue authenticating with a Git repository. This is common if you have incorrectly set up SSH authentication. To solve this error, make sure your SSH key is in your keychain and you connecting to a repository using the correct URL.


1 Answers

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.

like image 94
Lasse V. Karlsen Avatar answered Sep 28 '22 05:09

Lasse V. Karlsen