3
votes

Following the documentation here, I am trying to create a repository using the following command:
az repos create --name Example

Which returns the following error:

The command failed with an unexpected error. Here is the traceback:

TF401019: The Git repository with name or identifier client does not exist or you do not have permissions for the operation you are attempting. Operation returned an invalid status code of 404.

I have run the az login command, and set the organization and project as defaults in configuration using the following command:
az devops configure --defaults organization=https://dev.azure.com/example project=example

How can a repo be created using the Azure DevOps CLI?

3

3 Answers

1
votes

That has been seen here for accounts using 2FA

I tried something else - I did not delete the Git credentials, but I chose the option to modify them and I used login/password I generated as alias to my primary username (the one I used in the cli).
After VS restart I was able to push my changes.

This is only a workaround (my primary account still does not work in vs), but it will make my life easier for now.

Also:

I got a hint from another forum that i should try to run VS as an administrator (or as another user) and it worked.

I used the same account to authenticate in TFS, which is not working for my windows user account i normally use.

1
votes

This is going to sound so silly, but I created the repository with the same name using the Azure DevOps web UI, and then deleted it. After that I was able to create that repository using the Azure CLI, and any other repository.

0
votes

Looks like you have a permission issue and not that the create operation is failing. Can you verify the following:
1. Do you have permissions to create a repo in the project that has been set as default
2. Confirm if you are not working out of another git repo unintentionally. There is logic to auto detect configuration which in case of working out an unintended Azure Repos auto detects configuration and overrides the defaults set.

Have a look at the docs available at https://docs.microsoft.com/en-us/azure/devops/cli/index?view=azure-devops