ConfigLib icon indicating copy to clipboard operation
ConfigLib copied to clipboard

GitHub authentication problem

Open hankur opened this issue 3 years ago • 7 comments

Could not transfer artifact de.exlll:configlib-bukkit:pom:2.2.0 from/to de.exlll (https://maven.pkg.github.com/Exlll/ConfigLib): authentication failed for https://maven.pkg.github.com/Exlll/ConfigLib/de/exlll/configlib-bukkit/2.2.0/configlib-bukkit-2.2.0.pom, status: 401 Unauthorized

hankur avatar Dec 19 '21 08:12 hankur

Hi,

you need to login with your username and a token that has the required permissions. You can generate such a token under Settings -> Developer Settings -> Personal access tokens.

Exlll avatar Dec 20 '21 06:12 Exlll

I cant access it too.

Cobeine avatar Jan 01 '22 14:01 Cobeine

Currently, there is no way to access a package from the Github Package Registry without authentication. If you want to download a package that is hosted here on Github, you have to define a repository and provide your credentials.

For Gradle (using Kotlin DSL), first go to your .gradle/gradle.properties file and add the following two lines where the token is a Github Token which was generated as I described above:

github.actor=<GITHUB USERNAME>
github.token=<GITHUB TOKEN>

Then, you need to define the repository in your build.gradle.kts and add the dependency:

repositories {
    mavenCentral()
        // ...
        maven {
            url = uri("https://maven.pkg.github.com/Exlll/ConfigLib")
            credentials {
                username = project.findProperty("github.actor") as String?
                        ?: System.getenv("GITHUB_ACTOR")
                password = project.findProperty("github.token") as String?
                        ?: System.getenv("GITHUB_TOKEN")
            }
        }
    }
}

dependencies {
    implementation("de.exlll:configlib-core:2.2.0")
}

For Maven, you basically have to do the same as described here.

Exlll avatar Jan 01 '22 16:01 Exlll

Has there been any progress on alternative solutions?

Insprill avatar Jul 31 '22 23:07 Insprill

@Insprill I submitted a request to codemc.io to get access to Nexus almost a month ago. I guess they haven't had time to review this project. Three other people I asked recommended not using jitpack.io. Now I'm thinking about publishing to Maven Central but I'd prefer having a bit more control over the repository. Have you got any other suggestions?

Exlll avatar Aug 01 '22 00:08 Exlll

I've only ever used Maven Central, but it's worked great for me. I got approved in a couple of hours and it's very simple to get set up with Gradle and the Nexus Publish Plugin.

Insprill avatar Aug 01 '22 00:08 Insprill

@Insprill Using the latest commit, you should now be able to use jitpack.io.

Exlll avatar Aug 03 '22 20:08 Exlll

This library is now also published to Maven Central.

Exlll avatar Feb 24 '24 01:02 Exlll