2

我在我的 Windows 操作系统上安装了 GCM(Git Credential Manager)。使用它我可以成功push访问GitLabBitbucket存储库。但是关于Azure DevOps

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

然后提示输入用户名(独立于 GCM)。

有迹可循:

>SET GIT_TRACE=1

>SET GCM_TRACE=1

>git push Azure master
17:34:02.362309 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
17:34:02.364307 git.c:415               trace: built-in: git push Azure master
17:34:02.370303 run-command.c:637       trace: run_command: GIT_DIR=.git git remote-https Azure https://mirismaili.visualstudio.com/OpenLib/_git/Android
17:34:02.382598 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
17:34:02.383601 git.c:671               trace: exec: git-remote-https Azure https://mirismaili.visualstudio.com/OpenLib/_git/Android
17:34:02.384601 run-command.c:637       trace: run_command: git-remote-https Azure https://mirismaili.visualstudio.com/OpenLib/_git/Android
17:34:02.399961 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
17:34:03.391539 run-command.c:637       trace: run_command: 'git credential-manager get'
17:34:03.613232 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
17:34:03.615233 git.c:671               trace: exec: git-credential-manager get
17:34:03.615233 run-command.c:637       trace: run_command: git-credential-manager get
17:34:03.698676 ...\Common.cs:744       trace: [Main] git-credential-manager (v1.18.0) 'get'
17:34:03.793588 ...\Git\Where.cs:348    trace: [FindGitInstallations] found 1 Git installation(s).
17:34:03.802579 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 38 entries.
17:34:03.809873 ...\Common.cs:543       trace: [LoadOperationArguments] useHttpPath = ''.
17:34:03.879804 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://mirismaili.visualstudio.com/OpenLib/_git/Android'.
17:34:04.749863 ...uthentication.cs:229 trace: [DetectAuthority] detected 'https://mirismaili.visualstudio.com/' as Azure DevOps from GET response.
17:34:04.757022 ...\Program.cs:601      trace: [Run] ! error: 'Object reference not set to an instance of an object.'.
17:34:04.760018 ...\Common.cs:709       trace: [LogEvent] System.NullReferenceException: Object reference not set to an instance of an object.
   at AzureDevOps.Authentication.Authentication.<DetectAuthority>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AzureDevOps.Authentication.Authentication.<GetAuthentication>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Alm.Cli.CommonFunctions.<CreateAuthentication>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Alm.Cli.CommonFunctions.<QueryCredentials>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Alm.Cli.Program.<<Get>b__24_0>d.MoveNext()
17:34:04.769048 ...\Program.cs:601      trace: [Run] 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.
17:34:04.793392 run-command.c:637       trace: run_command: bash -c 'test "a$SHELL" '\!'= "a${SHELL%.exe}" || exit 127; cat >/dev/tty && read -r line </dev/tty && echo "$line"'

其他有用信息:

>git remote -v
Azure   https://mirismaili.visualstudio.com/OpenLib/_git/Android (fetch)
Azure   https://mirismaili.visualstudio.com/OpenLib/_git/Android (push)
BitBucket       https://mirismaili@bitbucket.org/mirismaili/androidopenlib.git (fetch)
BitBucket       https://mirismaili@bitbucket.org/mirismaili/androidopenlib.git (push)
GitLab  https://mirismaili@gitlab.com/OpenLib/android.git (fetch)
GitLab  https://mirismaili@gitlab.com/OpenLib/android.git (push)

>git version
git version 2.19.1.windows.1

>git credential-manager version
Git Credential Manager for Windows version 1.18.0

>git config -l
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslbackend=schannel
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
core.editor='C:\Program Files\Notepad++\notepad++.exe' -multiInst -notabbar -nosession -noPlugin
user.name=S. Mahdi Mir-Ismaili
user.email=s.m.mirismaili@gmail.com
gui.recentrepo=D:/I/Documents/CryptoCurrenciesSimulator
credential.usehttppath=true
credential.helper=manager
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.Azure.url=https://mirismaili.visualstudio.com/OpenLib/_git/Android
remote.Azure.fetch=+refs/heads/*:refs/remotes/Azure/*
branch.master.remote=BitBucket
branch.master.merge=refs/heads/master
remote.BitBucket.url=https://mirismaili@bitbucket.org/mirismaili/androidopenlib.git
remote.BitBucket.fetch=+refs/heads/*:refs/remotes/BitBucket/*
remote.GitLab.url=https://mirismaili@gitlab.com/OpenLib/android.git
remote.GitLab.fetch=+refs/heads/*:refs/remotes/GitLab/*

另一个注意事项是,我可以使用适用于 IntelliJ IDEAzure remoteVisual Studio Team Services 插件进行推送。

4

2 回答 2

3

我将 GCM 从v1.18.0更新到v1.18.2,问题解决了:

在此处输入图像描述

我认为它与v1.18.1 上的这个 BugFix相关:

修复未填充参数或 contentType 时的空引用异常

于 2018-11-07T23:04:46.887 回答
1

从今天开始,我的所有 Azure-DevOps-Repos 都遇到了同样的问题。我相信这指的是从 Visual Studio Team Services 到 DevOps 的变化。

我的解决方法如下:

  1. 我重新配置了 GIT 以保存凭据:

git config --global credential.helper store

  1. 我登录了我的 DevOps-Account 并创建了一个新的个人访问令牌

  2. 我打开了一个回购并执行了另一个提取

在出现 NullReferenceException 提示后,我输入了我的用户名并将创建的访问令牌粘贴到密码提示中。

现在,在与遥控器的每次交互中,我都会得到两个 NullReferenceException-Prompts,但它现在适用于我的所有 Azure-DevOps-Repos...

我不知道这将如何与 GitHub 等其他回购服务一起使用。我只使用 Azure...

这只是一个快速而肮脏的解决方法。因此,如果有人可以分享更好的解决方案,我将不胜感激。

谢谢

于 2018-11-07T17:27:02.177 回答