Search Unity

Package manager can't clone azure dev ops repos

Discussion in 'Package Manager' started by vrmYavuz, Feb 13, 2019.

  1. vrmYavuz

    vrmYavuz

    Joined:
    Mar 7, 2018
    Posts:
    5
    Hey i am trying to use package manager for my custom unity packages and i am trying to pull packages from git. I have succesfuly done it by using public github repo but in our company we are using azure devops so i would like to have my packages stored in azure devops repositories but when i am using my azure devops repo clone link package manager give an error like this

    com.vrm.packageName: Version 'https://ProjectName@dev.azure.com/CompanyName/ProjectName/_git/PackageName' is invalid. Expected a 'SemVer' compatible value or a value starting with 'file:', 'http:', 'https:', 'git:' or 'ssh:'.

    i have tried to clone this repository by using git clone command in terminal and it worked

    and i am tried to put '.git' to end of my repository link, when i am doing that it gives this error

    Error when executing git command. remote: TF401019: The Git repository with name or identifier CarouselSystem.git does not exist or you do not have permissions for the operation you are attempting.

    I dont understand what is the problem can anyone help me?
     
  2. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Hi @vrmYavuz,

    In order to disambiguate URLs internally, we require URLs to end with .git to use Git packages, so you had it right when you added the '.git' suffix.

    Next is that it seems to be an authentication issue: you're trying to access your repository using the 'ProjectName' user, without including a password. I presume that on the command-line, Git would ask you for your password? If so, then it's a bit different with the Package Manager because when it calls Git, it's not calling it over a shell where you can interactively provide Git with your password. There's a couple solutions:

    - Use SSH instead. This requires that you register an SSH key with the Git server that allows it to recognize that you're connecting as the 'ProjectName' user. (Typically this is done on a per-user basis, rather than using a shared username, like 'ProjectName', but YMMV.)
    - Configure a Git credential helper in your global settings. Take a look at https://git-scm.com/docs/gitcredentials for this. This might be non-trivial to set up, but I know it can work. (We'll eventually provide better instructions on how to set this up in our documentation.)
    - The easiest (but worst, in terms of security) is to use a URL with both username and password in it, e.g.
    https://ProjectName:Password@dev.azure.com/CompanyName/ProjectName/_git/PackageName
    . Warning: I do NOT recommend you do that: while that's probably fine for local tests, you should never share a project with such a Git URL added to it because you'd basically be handing the keys to that account to anyone fetching your project (i.e. they would have the same access level as you for all the repos on that server...)
     
    tiernan-costain likes this.
  3. vrmYavuz

    vrmYavuz

    Joined:
    Mar 7, 2018
    Posts:
    5
    @maximeb_unity first of all thank you for you answer.

    The repository which i store my package is a public one so anyone with a link can download it and when i try to get it from command line it doesnt ask for a password.

    https://VRMPackages@dev.azure.com/VRMPackages/CarouselSystem/_git/CarouselSystem

    anyone can get the repository from this url i am giving it in case you want to try it for yourself.

    But when i put '.git' to end of this link i cant clone it it gives error and unity package manager requires .git at end of it
    so i cant use azure repos for package manager is this a bug?
    Are you planning to support urls without .git at end?



    upload_2019-2-15_18-16-32.png
     
  4. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Hi @vrmYavuz,

    I confirm I cannot clone that URL with a trailing .git extension (getting prompted for credentials). Apparently Azure repos do not treat <git-url> and <git-url>.git as interchangeable, unlike Github, BitBucket and GitLab.

    The dev team will be notified of this bug. For the time being, it looks like you cannot use Azure repos. If your repo is public, I might suggest hosting your repo on one of the aforementioned repository hosting services, at least until we fix this.
     
  5. WWysocki

    WWysocki

    Joined:
    May 30, 2015
    Posts:
    6
  6. felipemunoz_unity

    felipemunoz_unity

    Unity Technologies

    Joined:
    Apr 5, 2019
    Posts:
    15
    Hi @WWysocki ! Unity Version 2019.1 should have support for "git" dependencies that don't need to end with .git
    Would you be able to give it a try and let us know if it worked for your use case?

    To use this feature, the url in the project manifest should be specified as:
    git+https://user@host/path/to/repo


    Edit: 2019.1 is currently available as a beta version.

    Cheers,
    Felipe
     
    Last edited: Apr 8, 2019
  7. WWysocki

    WWysocki

    Joined:
    May 30, 2015
    Posts:
    6
    Hi @felipemunoz_unity ! I just got it working with Azure DevOps repos in Unity 2019.1.0f1 and 2019.2.0.a11 :) Thanks!
     
  8. MrFabou

    MrFabou

    Joined:
    Jul 6, 2019
    Posts:
    6
    @WWysocki This is a really old post but how did you get it to work? I only get it with git hub.
    greetings!
     
  9. UnityMaru

    UnityMaru

    Community Engagement Manager PSM

    Joined:
    Mar 16, 2016
    Posts:
    1,227
    Did you try the advice in the post above theirs?
     
  10. unity_2843576BB26F3B8CA2A6

    unity_2843576BB26F3B8CA2A6

    Joined:
    Sep 14, 2022
    Posts:
    3
    3.5 years after, in Unity 2021.3 still not supporting connection via ssh to azure devops repositories...
    Tried all, including project renaming (from repositories side, added .git to the end):
    • git@ssh.dev.azure.com:v3/company/project
    • git@ssh.dev.azure.com:v3/company/project.git
    • git+git@ssh.dev.azure.com:v3/company/project
    • git+git@ssh.dev.azure.com:v3/company/project.git
    • git+ssh.dev.azure.com:v3/company/project.git
    • ssh://git@ssh.dev.azure.com:v3/company/project
    • ssh://git@ssh.dev.azure.com:v3/company/project.git
    • ssh://git@ssh.dev.azure.com:v3/company/project.git#branch
    nothin works. Nonsense...
     
  11. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Hi @unity_2843576BB26F3B8CA2A6,

    I'm sorry you're running into this issue. There's no reason for this not to work with some of the formats you used, so there's likely something specific to Azure DevOps that's causing problems.

    Among what you attempted, the first two should have worked.

    The other formats are incorrect, however. The last three (ssh://...) just need the ":" to be replaced with "/" to be valid URLs, and the first of those (without .git) needs "git+" prefix or ".git" path suffix for UPM to recognize it correctly.

    But basically, the first two should have just worked. What kind of error are you running into?
     
  12. unity_2843576BB26F3B8CA2A6

    unity_2843576BB26F3B8CA2A6

    Joined:
    Sep 14, 2022
    Posts:
    3
    The last three it's how it works with our gitlab repos)) Maybe it's wrong but it works on 2020 and 2021 LTS versions)


    [Package Manager Window] Cannot perform upm operation: Unable to add package [git@ssh.dev.azure.com:v3/company/project/repo]:
    Version range 'ssh.dev.azure.com:v3/company/project/repo' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    [Package Manager Window] Cannot perform upm operation: Unable to add package [git+git@ssh.dev.azure.com:v3/company/project/repo]:
    Package name 'git+git' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    [Package Manager Window] Cannot perform upm operation: Unable to add package [ssh://git@ssh.dev.azure.com:v3/company/project/repo]:
    Package name 'ssh://git' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    [Package Manager Window] Cannot perform upm operation: Unable to add package [git+ssh.dev.azure.com:v3/company/project/repo]:
    Package name 'git+ssh.dev.azure.com:v3/company/project/repo' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    [Package Manager Window] Cannot perform upm operation: Unable to add package [git@ssh.dev.azure.com:v3/company/project/repo.git]:
    Version range 'ssh.dev.azure.com:v3/company/project/repo.git' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    [Package Manager Window] Cannot perform upm operation: Unable to add package [git+git@ssh.dev.azure.com:v3/company/project/repo.git]:
    Package name 'git+git' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    [Package Manager Window] Cannot perform upm operation: Unable to add package [ssh://git@ssh.dev.azure.com:v3/company/project/repo.git]:
    Package name 'ssh://git' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    [Package Manager Window] Cannot perform upm operation: Unable to add package [git+ssh.dev.azure.com:v3/company/project/repo.git]:
    Package name 'git+ssh.dev.azure.com:v3/company/project/repo.git' is invalid. [InvalidParameter].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
     
  13. unity_2843576BB26F3B8CA2A6

    unity_2843576BB26F3B8CA2A6

    Joined:
    Sep 14, 2022
    Posts:
    3
    After fer more tests, few more broken wariants:

    An error occurred while resolving packages:
    Project has invalid dependencies:
    repo: Version 'git+ssh://git@ssh.dev.azure.com:v3/company/project/repo' is invalid. Expected one of: a 'SemVer' compatible value; a value starting with 'file:'; a Git URL starting with 'git:' or 'git+', or ending with '.git'.

    An error occurred while resolving packages:
    Project has invalid dependencies:
    repo: Version 'ssh://git@ssh.dev.azure.com:v3/company/project/repo' is invalid. Expected one of: a 'SemVer' compatible value; a value starting with 'file:'; a Git URL starting with 'git:' or 'git+', or ending with '.git'.

    An error occurred while resolving packages:
    Project has invalid dependencies:
    repo: Version 'ssh://git@ssh.dev.azure.com:22/v3/company/project/repo' is invalid. Expected one of: a 'SemVer' compatible value; a value starting with 'file:'; a Git URL starting with 'git:' or 'git+', or ending with '.git'.



    BUT.... If you specify port and set correct protocol - it's (absolutely unexpectedly) works!
    Correct formats which works (maybe someone from future will be glad to found this):
    • ssh://git@ssh.dev.azure.com:22/v3/company/project/repo.git (rename repo to ends with .git)
    • git+ssh://git@ssh.dev.azure.com:22/v3/company/project/repo
     
  14. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Thanks for the updates!

    One possible reason why some of your attempts failed is that
    <protocol>://<host>:<path>
    is not a valid URL format. The colon (":") in that place is used to mark the port, which is not provided. When you add the port (and get
    <protocol>://<host>:<port>/<path>
    ), then you make it a valid URL. When omitting the port, the colon must be omitted as well (
    <protocol>://<host>/<path>
    ). It may seem subtle, but it makes all the difference between something that's a URL and something that's not recognized as one.

    That said, the first two variants are based on Git's special SCP-like syntax (
    <user>@<host>:<path>
    ), which is actually not a valid URL, but is still supported by Git - and by UPM. This "compact" notation is inspired from the
    scp
    program, which implements secure file copying between computers over an SSH connection. That's why there's no "ssh://" prefix (SCP is strictly used over SSH) and no port, instead using ":" to separate the server name (or IP) and the remote path.

    Still,
    git@ssh.dev.azure.com:v3/company/project/repo
    should have worked since it should be recognized by UPM as Git's SCP-like syntax (
    git@<host>:<path>
    ). When I tried it on 2020.3.40f1,
    git@ssh.dev.azure.com:v3/company/project/repo
    was successfully detected as a Git-based dependency (it failed of course, but it was Git failing, not UPM thinking it was some kind of "version range"). What version did you get these failures on?