vsts build list does not work on valid git repository.
take git repository from project defined at azure devops (ssh.visualstudio.com:v3/$org/$project/$repo)
git clone repository to working directory
cd to working directory
run vsts build list and get the error ( see details below )
[remote "origin"] url inside .git/config from
[email protected]:v3/$org/$project/$repo
to
ssh://[email protected]:22/$org/$project/_ssh/$repo
vsts build list , now it succeeds $ 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.
@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
Most helpful comment
Fixed in Azure-Devops-Extension. Will be available in version 0.3.0