How to make Github packages to the public

I have created a simple maven archetype project : GitHub - hantsy/maven-archetype-jakartaee9: Maven archetype for Jakarta EE 9

And publish it via Github packages.

But read the docs from Github Packages, it requires authentication to install it.

  1. Is it possible to make the repository public to access(without an auth token)?
  2. Is there an approach to sync this repository to the Maven Central repository?
1 Like

Hi @hantsy,

At the moment a token is always required, but it is possible to encode/embed the token in your .pom file.

Here is how you would do it:

  1. Create a PAT with just the read:packages scope
  2. Execute $ docker run encode <PAT>
  3. This will generate a repositories element you can use in your .pom file

The repositories element will look something like this:


Replace <OWNER> with your user or org name.

Note, the read:packages token will have access to your public and private packages. If you have any private packages you need to project, you might want to create a machine-user account.

There isn’t currently a way to automatically sync with Maven Central.

I hope that helps!

Thanks @jcansdale, it is very helpful. I hope it can be added in the official docs.