代码之家  ›  专栏  ›  技术社区  ›  Mir-Ismaili

推送到Azure DevOps git repo:GCM:NullReferenceException

  •  2
  • Mir-Ismaili  · 技术社区  · 7 年前

    我在Windows操作系统上安装了GCM(Git凭证管理器)。我可以用它 push GitLab Bitbucket 存储库,成功。但是关于 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/*
    

    另一个提示是我可以推到 Azure remote ,与 Visual Studio Team Services plugin for IntelliJ IDEs

    2 回复  |  直到 7 年前
        1
  •  3
  •   Mir-Ismaili    7 年前

    我更新了GCM 1.18.0版 问题解决了:

    enter image description here

    我认为这与 this BugFix on v1.18.1

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

        2
  •  1
  •   Faberhagen    7 年前

    我的解决方法如下:

    git config --global credential.helper store

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

    2. 我打开了一份回购协议,执行了另一次回笼

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

    我不知道这将如何与其他回购服务,如GitHub等行为。我只使用Azure。。。

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

    谢谢

    推荐文章