dotnet / dotnet/sourcelink

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

Open
#1,230 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
1.4k
Forks
148
PR merge metrics
No merged PRs in 30d

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](https://learn.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops#q-how-do-i-use-different-ssh-keys-for-different-organizations-on-azure-devops)

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
```


```

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.