Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Resolve a package from a private github repo with a specific tag/version over SSH

Discussion in 'Package Manager' started by masta-yoda, Nov 11, 2021.

  1. masta-yoda

    masta-yoda

    Joined:
    Apr 19, 2020
    Posts:
    90
    In my manifest.json I have a custom dependency from a private GitHub repo and it works just fine in my Unity studio. The package can be resolved and integrated into my Unity project:

    {
    "dependencies": {
    "my-cool-sdk": "git@github.com:myname/my-cool-sdk.git",
    ...
    }
    }

    Now I want to add versioning, and start to tag my code with tags, e.g. "0.1". In accordance with the Unity Docs here and here I can specify the tag name at the end of the package path with hash and it should pull instead of the latest, that specific tag:

    "my-cool-sdk": "git@github.com:myname/my-cool-sdk.git#0.1",

    As soon as I change the config, Unity studio is unable to resolve the package with the following error:

    An error occurred: Version ... 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'

    upload_2021-11-10_22-2-15.png

    I tried to hack a little and add ssh:// as recommended in docs:

    "my-cool-sdk": "ssh://git@github.com:myname/my-cool-sdk.git#0.1",

    and got the following error (it's a private repo):

    Couldn't read from remote repository

    upload_2021-11-10_22-4-25.png

    My Unity version is 2021.2.0f1
    How can I reference a particular tag in a private GitHub repo accessible over SSH?
     
  2. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    273
    Maybe you should change the semver to "0.0.1". Semver is defined as having 3 parts: MAJOR.MINOR.PATCH.

    Source: https://semver.org/
    upload_2021-11-11_15-38-7.png
     
  3. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    273
    Or have you tried this URL?
    "my-cool-sdk": "ssh://git@myname.github.com/my-cool-sdk.git#0.1"
     
  4. masta-yoda

    masta-yoda

    Joined:
    Apr 19, 2020
    Posts:
    90
    > Maybe you should change the semver to "0.0.1". Semver is defined as having 3 parts: MAJOR.MINOR.PATCH.

    0.1 is just a tag name (string), not a version

    > "my-cool-sdk": "ssh://git@myname.github.com/my-cool-sdk.git#0.1"

    Yes I tried that, it doesn't work, unable to find URL (the second image in my post)
     
    matheus_inmotionvr likes this.
  5. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    273
    Yeah, I'm afraid I have nothing to contribute too. After answering you I've tried some other ways I can think of, but also no result. Atm I just don't have any spare time to work on this. But this problem will affect me in a very near future (maybe in some weeks).
     
  6. matheus_inmotionvr

    matheus_inmotionvr

    Joined:
    Oct 3, 2018
    Posts:
    56
    Any progress on this? We're running into the same issue and it seems impossible to target a specific version.

    Edit: this workaround did it for me.
     
    Aldeminor likes this.