Skip to content

git config with multiple keys causes error "The value of SourceRoot.RepositoryUrl with identity is invalid" #1230

Open
@PhotoAtomic

Description

I've multiple organization hosted on AzureDevOps and from the same machine i need to access with different identities to the repos of the different organizations
for this i've a config file in my ~/.ssh folder like this

Host vs-ssh.visualstudio.com
  HostName vs-ssh.visualstudio.com
  IdentityFile ~/.ssh/id_rsa
  IdentitiesOnly yes

Host duke.vs-ssh.visualstudio.com
  HostName vs-ssh.visualstudio.com
  IdentityFile ~/.ssh/id_rsa_duke
  IdentitiesOnly yes

as per microsoft's documentation here

i've cloned a repo using the host duke.vs-ssh.visualstudio.com

and now if i do
git remote get-url origin

i get
[email protected]:v3/photoatomic/OrderProcessor/OrderProcessor

But and when i compile i have the error

The value of SourceRoot.RepositoryUrl with identity 'D:\OrderProcessor\' is invalid: 'ssh://[email protected]/v3/photoatomic/OrderProcessor/OrderProcessor' LillaKitchen.OrderPrinter, LillaKitchen.OrderProcessor, LillaKitchen.Xmenu.Order, MessageParser, PhotoAtomic.Printing C:\Program Files\dotnet\sdk\8.0.300-preview.24203.14\Sdks\Microsoft.SourceLink.AzureRepos.Git\build\Microsoft.SourceLink.AzureRepos.Git.targets 28

if i change the remote url using

git remote set-url origin [email protected]:v3/photoatomic/OrderProcessor/OrderProcessor

and compile, the error goes away (but obviously i cannot push anymore)

but i don't want to have to change the URL every time i want to compile or push

above the C:\Program Files\dotnet\sdk\8.0.300-preview.24203.14\Sdks\Microsoft.SourceLink.AzureRepos.Git\build\Microsoft.SourceLink.AzureRepos.Git.targets
Line 28
i've found this


    <!--
      The task calculates SourceLink URL for a given SourceRoot.

      If the SourceRoot is associated with a git repository with a recognized domain the <see cref="SourceLinkUrl"/>
      output property is set to the content URL corresponding to the domain, otherwise it is set to string "N/A".

      Recognized domains are specified via Hosts (initialized from SourceLinkAzureReposGitHost item group).
      In addition, if SourceLinkHasSingleProvider is true an implicit host is parsed from RepositoryUrl.

      ContentUrl is optional. If not specified it defaults to "https://{domain}" or "http://{domain}", based on the scheme of SourceRoot.RepositoryUrl.
    -->

Which makes me think i've to fill in my alternate domain somewhere.
can someone explain me how to use this? it is quite obscure to me

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions