简体   繁体   English

推送到Azure DevOps git存储库:GCM:NullReferenceException

[英]push to Azure DevOps git repo: GCM: NullReferenceException

I installed GCM (Git Credential Manager) on my Windows OS. 我在Windows操作系统上安装了GCM(Git凭据管理器)。 Using it I can push to GitLab and Bitbucket repositories, successfully. 使用它,我可以成功地push送到GitLabBitbucket存储库。 But about Azure DevOps : 但是关于Azure DevOps

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

Then prompt for username (independent of GCM). 然后提示输入用户名(独立于GCM)。

With trace: 带痕迹:

>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"'

Other useful information: 其他有用的信息:

>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/*

Another note is that I can push to Azure remote , with Visual Studio Team Services plugin for IntelliJ IDEs . 另一个注意事项是,我可以使用IntelliJ IDE的Visual Studio Team Services插件推送到Azure remote

I updated GCM from v1.18.0 to v1.18.2 and the problem solved: 我将GCM从v1.18.0更新到了v1.18.2 ,问题已解决:

在此处输入图片说明

I think it was relevant to this BugFix on v1.18.1 : 我认为这与v1.18.1上的此BugFix有关

Fixes Null Reference exceptions when parameters or contentType are not populated 修复未填充参数或contentType时的Null引用异常

Hy 海兰

I had the same problem with all of my Azure-DevOps-Repos since today. 从今天开始,我所有的Azure-DevOps-Repos都遇到相同的问题。 I believe this refers to the change from Visual Studio Team Services to DevOps. 我相信这是指从Visual Studio Team Services到DevOps的转变。

My workaround was following: 我的解决方法如下:

  1. I reconfigured GIT to save credentials: 我重新配置了GIT以保存凭据:

git config --global credential.helper store

  1. I signed in my DevOps-Account and created a new personal access token 我登录了DevOps-Account并创建了一个新的个人访问令牌

  2. I opened one of my repos and executed another fetch 我打开了一个存储库并执行了另一个提取

After the NullReferenceException prompt, I entered my username and pasted the created access token inside the password prompt. 在NullReferenceException提示后,我输入了用户名,并将创建的访问令牌粘贴到了密码提示中。

Now, on each interaction with the remote i get two NullReferenceException-Prompts but it works now for all of my Azure-DevOps-Repos... 现在,在与遥控器的每次交互中,我都会得到两个NullReferenceException-Prompts,但是现在它适用于我所有的Azure-DevOps-Repos ...

I don't know how this will behave with other Repo-Services like GitHub and so on. 我不知道这与其他Repo-Service(如GitHub等)如何配合。 I do only use Azure... 我只使用Azure ...

This is only a quik and dirty workaround. 这只是一个快速且肮脏的解决方法。 So I would appreciate if someone could share a better solution. 因此,如果有人可以分享更好的解决方案,我将不胜感激。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM