Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PhotoAtomic opened this issue Apr 20, 2024 · 0 comments

Comments

@PhotoAtomic
Copy link

PhotoAtomic commented Apr 20, 2024

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
photoatomic@duke.vs-ssh.visualstudio.com: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://photoatomic@duke.vs-ssh.visualstudio.com/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 photoatomic@vs-ssh.visualstudio.com: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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant