git pull fatal: NullReferenceException encountered. On an local instance of Bitbucket

Created on 7 Oct 2018  Â·  15Comments  Â·  Source: git-for-windows/git

  • [ X] I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.19.1.windows.1
cpu: x86_64
built from commit: 11a3092e18f2201acd53e45aaa006f1601b6c02a
sizeof-long: 4
sizeof-size_t: 8

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.17134.320]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: VisualStudioCode
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: WinSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Enabled
Enable Builtin Rebase: Disabled
Enable Builtin Stash: Disabled

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

We are using a local install of Bitbucket.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

All three shells Git Bash, CMD and PowerShell exhibit the issue.

$ get pull
  • What did you expect to occur after running these commands?

I expected it to pull the code from the remote origin and print. Already up to date.

  • What actually happened instead?

fatal: NullReferenceException encountered.
Object reference not set to an instance of an object.
OpenSSH window for https://[email protected] pops up.
Enter my massword and press OK.
fatal: NullReferenceException encountered.
Object reference not set to an instance of an object.
Already up to date.

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

All repositories on our internal instance of Bitbucket. This issue does not occur against GitHub. I suspect that it is because we our admin implemented single sign on. I am not using ssh for the repositories in question only https. I can provide the URL, but only if contacted directly I don't want to expose it here.

Most helpful comment

Fixed in git credential manager 1.18.1. Just install over top.

https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.18.1

All 15 comments

I am seeing the same thing using 2.19.1 against our internal Bitbucket server. Reverting back to 2.19.0 the problem no longer occurs.

I'm getting the same on internal BitBucket server as well with 2.19.1, while there are no issues with 2.19.0:

git pull
fatal: NullReferenceException encountered.
   Object reference not set to an instance of an object.
Password for 'https://xxx@xxx':
fatal: NullReferenceException encountered.
   Object reference not set to an instance of an object.
Already up to date.

My installation was updated from 2.19.0 to 2.19.1 with Chocolatey

I don't find the error message in the code: git grep ' not set ' origin/master (the search was one that did give some output for a quick peruse...) - maybe the issue is in the handling of the credentials.

Has it also been reported to BitBucket?

git push getting the same on Azure DevOps as well with 2.19.1.

fatal: NullReferenceException encountered.
未将对象引用设置到对象的实例。

I can see this issue appear only when interacting with http repos. It may be a duplicate of this:
https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/774

the new release Comes with Git Credential Manager v1.18.0. (ignore the first 'comes with'..)

I'm guessing that the PR Treat null credentials and tokens as invalid; not as exception errors may be involved from a cursory glance at the various commits that are included in v1.18.0

Installing the previous version of git credential manager, 1.17.2, resolves the authentication issues for now.

https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.17.2

I am seeing the same thing using 2.19.1 against our internal Bitbucket server. Reverting back to 2.19.0 the problem no longer occurs.

@adrian109 you may want to consider @epilsits 's solution because of the reason for the V2.19.1 release given in https://public-inbox.org/git/[email protected]/

Ultimately, someone will need to have a careful look at (probably the format of) the credentials being passed to see what caused that 'null reference' that is now being treated as 'fatal'

Fixed in git credential manager 1.18.1. Just install over top.

https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.18.1

I'm assuming this will be fixed in an upcoming version of git as well? That is, distributing the new credential manager.

@Lassevk moderately soon, hopefully, there will be a minor version release of Git for Windows that will include the updated GCM v1.18.1. [just need more volunteer time for the PR and tests ;-)
That should eliminate the `Fatal: NullReferenceException" but appears not to fix the #1874 https://github.com/git-for-windows/git/issues/1874 delays. (still to hear from the OP if the issue is definitely the AV, or something elese)

I've been able to fix it by:
git config credential.helper store
git config --unset credential.helper
git config --global credential.helper store
Referenced in this SO article https://stackoverflow.com/questions/5343068/is-there-a-way-to-skip-password-typing-when-using-https-on-github

However, I was going to revert to 2.19.0 to fix it until this worked. Not ideal because it stores the credentials in a text file according to the article, but I am working again.

This comment nails it: it is fixed in Git Credential Manager v1.18.1, which you can install on top of Git for Windows.

I'm assuming this will be fixed in an upcoming version of git as well? That is, distributing the new credential manager.

To answer the implied question (I cannot answer the explicit question whether you assume this): yes, the next official Git for Windows version will have a new Git Credential Manager version. Also, the current snapshot at https://wingit.blob.core.windows.net/files/index.html should have it already.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlk-pavan picture dlk-pavan  Â·  4Comments

jesterKing picture jesterKing  Â·  3Comments

daxelrod picture daxelrod  Â·  4Comments

0x7cc picture 0x7cc  Â·  4Comments

Snaptags picture Snaptags  Â·  4Comments