Azure-devops-cli-extension: azure-devops extension unable to parse devops repos ssh urls to detect organization and project

Created on 2 Nov 2018  路  7Comments  路  Source: Azure/azure-devops-cli-extension

Summary

vsts build list does not work on valid git repository.

Steps to reproduce:

  1. take git repository from project defined at azure devops (ssh.visualstudio.com:v3/$org/$project/$repo)

  2. git clone repository to working directory

  3. cd to working directory

  4. run vsts build list and get the error ( see details below )

Workaround:

  1. change [remote "origin"] url inside .git/config

from

[email protected]:v3/$org/$project/$repo

to

ssh://[email protected]:22/$org/$project/_ssh/$repo

  1. run vsts build list , now it succeeds

Details:

$ git pull
Already up-to-date.

$ vsts build list
--instance must be specified. The value should be the URI of your VSTS account, for example: https://<account>.visualstudio.com or your TFS project collection. You can set a default value by running: vsts configure --defaults instance=https://<account>.visualstudio.com. For auto detection to work (--detect on), you must be in a local Git directory that has a "remote" referencing a VSTS or TFS repository.
bug ProToCol

Most helpful comment

Fixed in Azure-Devops-Extension. Will be available in version 0.3.0

All 7 comments

@melezhik - thank you reporting this issue. We are looking into this.

I just tried it with an ssh remote set as [email protected]:v3/<org>/<tp>/<repo> and it failed with --instance must be specified.. I changed it to https in the format https://<org>@dev.azure.com/<org>/<tp>/_git/<repo> and it worked.
Both urls came from the Azure DevOps portal. Clearly SSH is causing problems in VSTS CLI.

I'm getting similar issue where the CLI is using the remote in the .git/config when I've logged in to a different instance

@steveculshaw Is it a similar issue or same one? Are you using ssh git remote?
Did you try the workaround suggested above by @giggio to confirm it works for you with non ssh remote?

ssh remote handling will be taken care of in the fix for this issue.

@atbagga Just similar ... I wasn't using ssh git remote. My issue was even though I was logged in to one VSTS organisation, if I issued cli commands in a directory with a .git/config, the remote in the config was used, not the organisation I specified. Change to a different directory, and worked find. I only worked out why when I was looking at the log file

@steveculshaw Thanks for the feedback! Glad that you could troubleshoot and figure out the issue.

As you already figured out, when inside a git directory, organization, project in the remote url takes precedence over set defaults (vsts configure --defaults instance=<your org url> project=<your project name>). This is the current behavior and my understanding is you do not have an issue with it.

However your issue with confusion around which organization is being used seems valid, and can be resolved with documentation and better error message.

Fixed in Azure-Devops-Extension. Will be available in version 0.3.0

Was this page helpful?
0 / 5 - 0 ratings