Could not obtain credentials’ error
See original GitHub issueI created a NuGet package that enables source link by adding the following to the csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>x</PackageId>
<PackageVersion>0.0.12</PackageVersion>
<Authors>y</Authors>
<Owners>z</Owners>
<Company>z</Company>
<RepositoryUrl>repoUrl</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Description>a</Description>
<PackageReleaseNotes>b</PackageReleaseNotes>
<Copyright>Copyright</Copyright>
<PackageTags>d</PackageTags>
</PropertyGroup>
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<DebugType>portable</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.AzureDevOpsServer.Git" Version="1.0.0" PrivateAssets="All"/>
<SourceLinkAzureDevOpsServerGitHost Include="c" VirtualDirectory="tfs"/>
</ItemGroup>
</Project>
The build completes without error or warning with accurate sourcelink metadata in the obj folder. The NuGet package deploys to our internal packaging repository successfully. NuGet Package Explorer detects no errors and reports the proper Repository information.
Visual studio successfully finds the symbols when debugging and attempts to download the source via SourceLink.
The source download fails with the following error:
Looking for source using SourceLink(https://c/repoUrl)
Source Link errors:
git-credential-manager-core.exe: Could not obtain credentials. Unexpected output: ‘protocol=https
host=c
username=
password=
‘.
ERROR: The request failed with code 401 : “Unauthorized”.
The file was not found with SourceLink
I have Visual Studio 2019 16.11.1 configured to use git-credential-manager-core (installed by Visual Studio Installer => Git For Windows) and I am able to successfully push to the Remote repo using the Git Changes window.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\etc\gitconfig
[credential]
helper = manager-core
[include]
; include Git for Windows' system config in order
; to inherit settings like `core.autocrlf`
path = C:/Program Files (x86)/Git/etc/gitconfig
path = C:/Program Files/Git/etc/gitconfig
I have to imagine the version of git-credential-manager-core used by SourceLink is looking for a different gitconfig? I have to assume it’s missing the credentials? On the same window as the error above there is a blue link to “Authenticate with SourceLink(repoUrl)” and clicking it doesn’t seem to do anything.
C:\WINDOWS\System32>git --version
git version 2.31.1.windows.1
C:\WINDOWS\System32>git credential-manager-core --version
2.0.394-beta+3fc6791abf
I tried to use git credential-manager-core store
to store a PAT for AzureDevOpsServer but I am unable to make it through the prompt without it erroring about “fatal: parsing “*.domain.com” - Quantifier {x,y} following nothing.”. I wasn’t able to figure out what its looking for. I tried typing these one line at a time and pressing enter. then a double enter at the end.
protocol=https
host=domain.com
username=test
password=pattoken
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (4 by maintainers)
Top GitHub Comments
@chuckries @tmat the /sources path was user error 😦 I forgot to update both NuGet packages in my test solution when trying to test after making some dockerfile changes.
@bwilliams1 I also just noticed that you’re using Azure DevOps but this is falling into GCM based authentication, which is not expected. Are you using hosted Azure DevOps (i.e. a .visualstudio.com or dev.azure.com account)? Or are you using Azure DevOps Server which is hosted on prem?