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

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’

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

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

Maybe you should change the semver to “0.0.1”. Semver is defined as having 3 parts: MAJOR.MINOR.PATCH.

Source: https://semver.org/

Or have you tried this URL?
"my-cool-sdk": "ssh://git@myname.github.com/my-cool-sdk.git#0.1"

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)

1 Like

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).

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.

1 Like