# Using GitHub Packages Registry with Unity Package Manager

**URL:** https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073
**Category:** Package Manager
**Tags:** Package-Manager, Official
**Created:** [April 5, 2020, 4:34pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073 "2020-04-05T16:34:53Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![okcompute\_unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/okcompute_unity/32/44211_2.png) [@okcompute\_unity](https://discussions.unity.com/u/okcompute_unity)
#### Post date: [April 5, 2020, 4:34pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/1 "2020-04-05T16:34:53Z")

</div>

Hi,

Thanks to forum user @JakHussain , there is now a known method to use _GitHub Packages Registry_ with _Unity Package Manager_. See [the original post](https://discussions.unity.com/t/768707/8) where @JakHussain shared his clever finding.

_ **WARNING** _: Using _GitHub Packages registries_ with _Unity Package Manager_ comes with a couple of limitations (Goto the end of the post for the list). Please be aware that we are posting this only to share community knowledge. **Unity doesn’t officially support GitHub Packages Registry**. Use it at your own risk.

There are a couple of steps needed to make it work.

**1** - You need to configure the `publishConfig` setting as [described in GitHub Packages Registry documentation](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#publishing-a-package-using-publishconfig-in-the-packagejson-file) in a special way. You need to suffix the pakcage **scope** :

```javascript
  "publishConfig": { "registry": "https://npm.pkg.github.com/@USER" },

```

Where USER is the Github organization or user (i.e.the scope). Basically, we are cheating on how NPM works and _inject_ the scope in the registry URL instead of prefixing the package name. This is one half of the trick. Unity Package Manager doesn’t accept the `@` and `/` characters in package names. By moving the scope reference in the registry URL we don’t need these characters in the package name anymore!

Add the `publisConfig` configuration in your package manifest (package.json)

**2** - Set the name of your package without an NPM scope

This is the other part of the magic. As stated in **step #1** , make sure you don’t prefix you package name with an NPM scope ( @ )

Example:

```javascript
  "name": "com.my-company.my-package",

```

**Not** :

```javascript
  "name": "@USER/com.my-company.my-package",

```

**WARNING** : If you have previously published a package with an NPM scope in the name, it won’t work. Your package should not have an MPM scope **for all existing versions**. It won’t work otherwise.

**3** - Publish your package

For that step, you can refer to [GitHub documentation](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#publishing-a-package).

**4** - Configure the scope registry in your Unity project manifest

```csharp
  "scopedRegistries": [
    {
      "name": "Company Packages",
      "url": "https://npm.pkg.github.com/@USER",
      "scopes": [
        "com.my-company"
      ]
    }
  ],

```

The URL must match the one configured in your publishConfig above in **step #1**.

**5** - Setup Npm Auth configuration

**WARNING** : _GitHub Packages registry_ always requires authentication. For private **and** public packages.

For this one, I’ll refer you to another [post I’ve made explaining how](https://discussions.unity.com/t/778442) .

**6** - Add your package in your project manifest

_GitHub Package Registry_ packages won’t show up in the Package Manager UI **All** section. You have to [install the package manually in your project manifest](https://docs.unity3d.com/Manual/upm-manifestPrj.html).

**Known limitations**

- The main limitation is discoverability. Even if your Github Packages registry-based scoped registry is correctly configured, packages won’t show up in the Package Manager UI’s **All** section. GitHub doesn’t support any of the NPM search API endpoints (/-/all or /-/v1/search). You will have to resort to [GitHub UI to search packages](https://help.github.com/en/github/searching-for-information-on-github/searching-for-packages) and manually add them to your project manifest.
- Even if the GitHub Registry package is public, your users will need to provide authentication.

As you can see, using GitHub Packages Registry with Unity Package Manager is not trivial. But, if you really need it, you can make it work!

Hope this post will be useful to some of you. Again, thank you to @JakHussain for discovering how it can be done!

Regards,

Pascal and the Unity Package Manager team.

---

<div class="post-metadata">

### Author: ![Thaina](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/thaina/32/93260_2.png) [@Thaina](https://discussions.unity.com/u/Thaina)
#### Post date: [April 8, 2020, 4:01am UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/2 "2020-04-08T04:01:11Z")

</div>

This is sad. We should have option to use

```auto
"publishConfig": { "registry": "https://npm.pkg.github.com" },

// with

"name": "USER/com.my-company.my-package", // without @

```

Instead. This would be easier to orchestrate cross domain dependency. I may publish project that utilize project of other person or other organization easily. It would critically expand the usage of package manager over everything in one go with just one line of registry

---

<div class="post-metadata">

### Author: ![JakHussain](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/jakhussain/32/416404_2.png) [@JakHussain](https://discussions.unity.com/u/JakHussain)
#### Post date: [April 9, 2020, 4:56pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/3 "2020-04-09T16:56:06Z")

</div>

@Thaina that’s down to how githubs package registry works rather than how unitys package manager works unfortunately. So far my experience with GitHub Packages has been pretty underwhelming since they really don’t make it easy for you to use. Fingers crossed for the future though!

---

<div class="post-metadata">

### Author: ![RobertAcksel](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@RobertAcksel](https://discussions.unity.com/u/RobertAcksel)
#### Post date: [May 6, 2020, 9:11am UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/4 "2020-05-06T09:11:25Z")

</div>

> [@okcompute\_unity](#):
>
> **WARNING** : If you have previously published a package with an NPM scope in the name, it won’t work. Your package should not have an MPM scope **for all existing versions**. It won’t work otherwise.

Why this? This excludes GitLab for use since GitLab requires scopes to be present and rejects packages without scopes.  
Seems that your suggested cheat does not work with Gitlab. And cheating should never be necessary (strictly against cheating, makes life harder for all of us).

‘Packages must be scoped in the root namespace of the project.’  
from [https://docs.gitlab.com/ee/user/packages/npm\_registry/#package-naming-convention](https://docs.gitlab.com/ee/user/packages/npm_registry/#package-naming-convention)

---

<div class="post-metadata">

### Author: ![JakHussain](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/jakhussain/32/416404_2.png) [@JakHussain](https://discussions.unity.com/u/JakHussain)
#### Post date: [May 6, 2020, 12:11pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/5 "2020-05-06T12:11:39Z")

</div>

> [@RobertAcksel](#):
>
> Why this? This excludes GitLab for use since GitLab requires scopes to be present and rejects packages without scopes.  
> Seems that your suggested cheat does not work with Gitlab. And cheating should never be necessary (strictly against cheating, makes life harder for all of us).
> 
> ‘Packages must be scoped in the root namespace of the project.’  
> from [https://gitlab.iavgroup.local/help/user/packages/npm\_registry/index.md](https://gitlab.iavgroup.local/help/user/packages/npm_registry/index.md)

I would chalk this up to githubs package registry forcing our hand in cheating in this way. As far as I can tell, unitys package manager isn’t the bottle neck in how packages are read and pulled in.

---

<div class="post-metadata">

### Author: ![JesperSmith](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@JesperSmith](https://discussions.unity.com/u/JesperSmith)
#### Post date: [May 8, 2020, 3:32pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/6 "2020-05-08T15:32:57Z")

</div>

Thanks for this guide. I tested it and it seems to work. We have the need to share with outside resources and this will help, although a pain to setup.

We are using some custom tooling to manage/publish NPM packages, and this could be added to it.

Is there a future where you think packages with the naming scheme @anon_3270756 /package-name will be supported? It seems that this is enforced by multiple NPM repository hosts. An option could be to ignore @anon_3270756 / in the name except when pulling from the NPM repo, so the full package name will become “@vendor/tld.vendor.package-name”

---

<div class="post-metadata">

### Author: ![okcompute\_unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/okcompute_unity/32/44211_2.png) [@okcompute\_unity](https://discussions.unity.com/u/okcompute_unity)
#### Post date: [May 8, 2020, 3:54pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/7 "2020-05-08T15:54:47Z")

</div>

Hi @JesperSmith ,

As you pointed out, the Gitthub Packages Registry is not easy to use with the Package Manager. Since it lacks discoverability API, we will not put more effort to try to be compatible with this registry. Maybe you can reach out to GitHub and ask them to support UPM registries format (including documentation, adapted API, etc.)?

Regards,

Pascal

---

<div class="post-metadata">

### Author: ![JesperSmith](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@JesperSmith](https://discussions.unity.com/u/JesperSmith)
#### Post date: [May 12, 2020, 3:21pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/8 "2020-05-12T15:21:53Z")

</div>

Fair enough. I’ll see if we can make some extra tooling on our side to make it work well enough for our purposes.

---

<div class="post-metadata">

### Author: ![RobertAcksel](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@RobertAcksel](https://discussions.unity.com/u/RobertAcksel)
#### Post date: [May 14, 2020, 12:02pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/9 "2020-05-14T12:02:05Z")

</div>

> [@okcompute\_unity](#):
>
> As you pointed out, the Gitthub Packages Registry is not easy to use with the Package Manager. Since it lacks discoverability API, we will not put more effort to try to be compatible with this registry. Maybe you can reach out to GitHub and ask them to support UPM registries format (including documentation, adapted API, etc.)?

Unity would not need to support Github natively. We would even be capable of developing an extension on our own to discover packages on any registry which makes this somehow possible via an API. I don’t belive GitHub will go implementing UPM registries format.

Instead we are asking to support the NPM Scoping syntax which we will not be able to support via an extension on our own (except of hacking around it which would end up in writing our own package manager)  
This is because NPM registries like the one of GitLab (not GitHub…) **requires** a scope for packages and this is why unity editor can not import those packages from GitLab.

(Maybe there is a better thread for this or there should be one)

---

<div class="post-metadata">

### Author: ![Favo-Yang](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/favo-yang/32/82958_2.png) [@Favo-Yang](https://discussions.unity.com/u/Favo-Yang)
#### Post date: [May 14, 2020, 2:19pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/10 "2020-05-14T14:19:39Z")

</div>

I think the issue been discussed a few times. Supporting /-/all/ discovery endpoint is a better-to-have thing. What really blocks this is the scopeRegistry syntax rejects “@” letter. Unity decides to use dot notation as the scope, but other NPM based registry defaults to @ syntax. It didn’t sound like a tech limitation but a design decision that whether @ conflicts with dot notation. Maybe there’re other reasons behind, but for me, below are all valid scopes.

- com.company

- @

- @ /com.company

Sure, there’re other registries that won’t force you to use @ as scope for the private package. But it’s kinda convention here for NPM, GitHub and GitLab. They’re all big players on the market.

---

<div class="post-metadata">

### Author: ![sbinter\_levelex](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@sbinter\_levelex](https://discussions.unity.com/u/sbinter_levelex)
#### Post date: [May 27, 2020, 4:20pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/11 "2020-05-27T16:20:53Z")

</div>

Using 2019.3.7f1 we have been unable to replicate this behavior. UPM fails to pull in the manually specified package due to an inability to find it. Using npm install with the same token pointed towards the same URL works perfectly.

This forum thread is only a little less than 2 months old, so it seems a bit strange that the behavior would already have diverged.

---

<div class="post-metadata">

### Author: ![TactileGames](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/tactilegames/32/399259_2.png) [@TactileGames](https://discussions.unity.com/u/TactileGames)
#### Post date: [October 15, 2020, 5:52pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/12 "2020-10-15T17:52:13Z")

</div>

This workaround seems to have been broken by a recent change by Github:

> **[Build software better, together](https://github.com/orgs/community/discussions/)**
>
> GitHub is where people build software. More than 150 million people use GitHub to discover, fork, and contribute to over 420 million projects.

They no longer allow publishing of packages without the scope in the name.

@okcompute_unity - do you know of any way that we can work around this and continue to use the Github Package Registry with Unity 2019.4?

Alternatively, can you provide any suggestions for an alternative private package manager, that does not require us to host our own package manager (i.e. we are not really interested in self hosting verdaccio)?

Best regards,  
Morten

---

<div class="post-metadata">

### Author: ![okcompute\_unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/okcompute_unity/32/44211_2.png) [@okcompute\_unity](https://discussions.unity.com/u/okcompute_unity)
#### Post date: [October 15, 2020, 6:30pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/13 "2020-10-15T18:30:37Z")

</div>

> [@TactileGames](#):
>
> This workaround seems to have been broken by a recent change by Github:
> 
> [https://github.community/t/unable-to-publish-packages-with-different-name-to-publish-url-as-of-07-10-2020/136643](https://github.community/t/unable-to-publish-packages-with-different-name-to-publish-url-as-of-07-10-2020/136643)
> 
> They no longer allow publishing of packages without the scope in the name.
> 
> @okcompute_unity - do you know of any way that we can work around this and continue to use the Github Package Registry with Unity 2019.4?
> 
> Alternatively, can you provide any suggestions for an alternative private package manager, that does not require us to host our own package manager (i.e. we are not really interested in self hosting verdaccio)?
> 
> Best regards,  
> Morten

Hi @TactileGames ,

I’m sorry you were affected by this change from Github. Some discussions are happening right now between Unity and Github. I cannot promise anything but fingers crossed!

In the meantime, a self-hosting solution that I can recommend is JFrog’s Artifactory ([https://jfrog.com/artifactory/](https://jfrog.com/artifactory/)). Easy setup and they offer a free tier that can be interesting for a small team/studio.

Regards,

Pascal

---

<div class="post-metadata">

### Author: ![okcompute\_unity](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/okcompute_unity/32/44211_2.png) [@okcompute\_unity](https://discussions.unity.com/u/okcompute_unity)
#### Post date: [October 16, 2020, 3:12pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/14 "2020-10-16T15:12:11Z")

</div>

> [@TactileGames](#):
>
> They no longer allow publishing of packages without the scope in the name.

I was told this morning by Github that they reverted the change they made:  
[https://github.community/t/unable-to-publish-packages-with-different-name-to-publish-url-as-of-07-10-2020/136643/11?u=jcansdale](https://github.community/t/unable-to-publish-packages-with-different-name-to-publish-url-as-of-07-10-2020/136643/11?u=jcansdale)

So the method described in this post should work again. Note that I was advised this is temporary but it should work for a while. The next major version of their system may not support this anymore.

Reminder: Unity doesn’t officially support the Github Packages registry. Github did not implement all the npm API UPM relies on for the _scoped registries_ feature.

Regards,

Pascal

---

<div class="post-metadata">

### Author: ![ddsim](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@ddsim](https://discussions.unity.com/u/ddsim)
#### Post date: [October 17, 2020, 5:13pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/15 "2020-10-17T17:13:19Z")

</div>

@okcompute_unity  
Excellent that it works again.

What is the reason that the Unity Package Manager doesn’t allow package names beginning with an `@` scope?

---

<div class="post-metadata">

### Author: ![anon44112406](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@anon44112406](https://discussions.unity.com/u/anon44112406)
#### Post date: [November 6, 2020, 3:50pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/16 "2020-11-06T15:50:17Z")

</div>

@okcompute_unity Thank you for the guide ! It works, I succeed to publish my package on GitHub and download it on a project with the scoped registry.

There is just one issue on the Package Manager. As you said, GitHub doesn’t support for searching, but the Package Manager will try anyway and it “crash” it a bit.

 ![6497254--731149--fail.png](https://europe1.discourse-cdn.com/unity/original/3X/7/3/732d1cb4d6eed06eed875ce068fd7dd17bb76b11.png)

I’m on the “All packages” section, but once it failed to search on GitHub, it won’t load any others packages … It could be nice to just display a warning or fail silently.

For information, i’m on 2019.4.5f1

---

<div class="post-metadata">

### Author: ![LE-Peter](https://avatars.discourse-cdn.com/v4/letter/l/76d3ee/32.png) [@LE-Peter](https://discussions.unity.com/u/LE-Peter)
#### Post date: [November 8, 2020, 3:23pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/17 "2020-11-08T15:23:46Z")

</div>

I’ve gotten as far as steps 4/5/6 - not sure which bit is failing. Package is hosted on a private GitHub organization repo.

Unity gives me.

> [@](#):
>
> Cannot perform upm operation: Request [GET [https://npm.pkg.github.com/@](https://npm.pkg.github.com/@)/-/v1/search?text=com..&from=0&size=250] failed with status code [405] [NotFound]  
> UnityEditor.EditorApplication:Internal\_CallUpdateFunctions()

I’ve got the .upmconfig.toml setup in Users/MyLogin/ with

> [@](#):
>
> [npmAuth.“[https://npm.pkg.github.com/@](https://npm.pkg.github.com/@)”]  
> token = “”  
> email = “”  
> alwaysAuth = true

The project manifest.json is like so:

> [@](#):
>
> {  
> “scopedRegistries”: [  
> {  
> “name”: “Company Toolkit”,  
> “url”: “[https://npm.pkg.github.com/@](https://npm.pkg.github.com/@)”,  
> “scopes”: [  
> “com..”  
> ]  
> }  
> ],  
> “dependencies”: {  
> …  
> }

---

<div class="post-metadata">

### Author: ![bigcheese](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/bigcheese/32/454437_2.png) [@bigcheese](https://discussions.unity.com/u/bigcheese)
#### Post date: [November 22, 2020, 7:11am UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/18 "2020-11-22T07:11:39Z")

</div>

Has anyone tried to have package dependencies and if you need to do the following with the scope @ /com.test.dependency ?

---

<div class="post-metadata">

### Author: ![frank-ijsfontein](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/frank-ijsfontein/32/90944_2.png) [@frank-ijsfontein](https://discussions.unity.com/u/frank-ijsfontein)
#### Post date: [December 8, 2020, 12:29pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/19 "2020-12-08T12:29:54Z")

</div>

Will the Unity Package Manager support npm’s scope notation in future versions? We use GitLab, and it can host npm packages, but only when using exactly that (" @anon_3270756 /package.name") naming convention. So after getting my package published on our GitLab server, I found out that all my work was for nothing because the UPM is not fully npm compatible.  
Should have read this thread first I guess. But seeing that GitHub also tried moving into the scoped naming requirement, are you going to fix this?

---

<div class="post-metadata">

### Author: ![UnityMaru](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/unitymaru/32/44206_2.png) [@UnityMaru](https://discussions.unity.com/u/UnityMaru)
#### Post date: [December 18, 2020, 12:11pm UTC](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073/20 "2020-12-18T12:11:32Z")

</div>

In our view, this is not something that needs to be fixed, but a new feature request that we don’t plan to implement at this time. We don’t plan to support npm’s scope notation in the package names, a package with the name `@foo/bar` is not valid.

[Next page](https://discussions.unity.com/t/using-github-packages-registry-with-unity-package-manager/784073.md?page=2)
