Serhii Zadorozhnyi
Serhii Zadorozhnyi

Reputation: 626

How to access private Github package registry via Gradle

Can't access private GitHub package registry

Checked info on "jcenter" how to make custom dependency, but there nothing about private dependency

build.gradle:

repositories{
 jcenter(){
   url "my_custom_package_githubRepository"
 }
}

dependencies{
  compile 'my_custom_dependency'
}

Expect how to get access to private GitHub package registry

Upvotes: 4

Views: 2951

Answers (1)

Rodrigo Bautista
Rodrigo Bautista

Reputation: 61

Follow this: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry#authenticating-to-github-packages Be careful on how you set your id and token.

    repositories {
    maven {
        url = uri("https://maven.pkg.github.com/OWNER/REPOSITORY")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
            password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
        }
    }
}

Upvotes: 3

Related Questions