AndroidLibraryForGitHubPackagesDemo
AndroidLibraryForGitHubPackagesDemo copied to clipboard
Received status code 403 from server: Forbidden
Hi, thanks for your article, it was very enlightening!
Yet, I bumped into something. This is the repo: https://github.com/cesarferreira/android-unique-device-id
I'm trying to upload the github package, I followed your guide and it looks like i'm doing everything right but i keep getting this error:
~/code/github/android-unique-device-id master
❯ ./gradlew assembleRelease publish
> Task :android-unique-device-id:publishBarPublicationToGitHubPackagesRepository FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android-unique-device-id:publishBarPublicationToGitHubPackagesRepository'.
> Failed to publish publication 'bar' to repository 'GitHubPackages'
> Could not PUT 'https://maven.pkg.github.com/cesarferreira/android-unique-device-id/cesarferreira/android-unique-device-id/0.0.1/android-unique-device-id-0.0.1.aar'. Received status code 403 from server: Forbidden
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
59 actionable tasks: 3 executed, 56 up-to-date
my build gradle: https://github.com/cesarferreira/android-unique-device-id/blob/master/android-unique-device-id/build.gradle
def getArtifactId = { ->
return "android-unique-device-id"
}
publishing {
publications {
bar(MavenPublication) {
groupId 'cesarferreira'
version "0.0.1"
artifactId getArtifactId()
artifact("$buildDir/outputs/aar/${getArtifactId()}-release.aar")
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/cesarferreira/android-unique-device-id")
credentials {
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_TOKEN")
}
}
}
I even made a token with ALL permissions to see if those basic permissions weren't enough.
I made sure that the environment variables are there.
Does anything stand out to you that I'm missing? Thanks in advance!
Hi, Your implementation works fine. I was able to publish your android library onto my account after replacing the Username and Token and the groupId. Might be the 403 frobidden error is related to SSH / Https.
what group id did you use? not cesarferreira
right?
This is very weird, I even created a token with ALL the permissions and it still didnt work
it got uploaded with the cesarferreira groupID, but onto my GitHub (as seen in the attached image on earlier comment). I will delete the package/repo if you have a conflict with the groupID.
The problem is definitely not with the token. My guess, when you are pushing the package onto Github, the servers are not allowing this. if it was the token/credentials, it would show a related message.
Please try cloning the project with Https clone and it should work.
The same happens :/
- I could reproduce the 403 forbidden error with my Library, while doing a SSH clone. Once I cleanedup the SSH token and did a HTTPS clone the new version of my library was uploaded fine. SSH protocol is not supported for uploading github packages.
- I also noticed that 403 errors is also thrown when the version number of the library is the same on Github
- Possibly, since I already have uploaded the package with your GroupdID, there is bound to be a 403 Error or similar, again as the groupID and package is already used.
@cesarferreira were you able to resolve this issue?
Couldn't in the end, opened an issue with github team but they never got back to me, thanks a lot @prasad79. WHen they get back to me I'll let you know what was the problem :)
Perfect. Meanwhile I sent a request to the GitHub Support team to delete the package I uploaded with your group ID "cesarferreira.android-unique-device-id" The support team has deleted it and so you should not have any conflicts with it
Same here, 403 I couldn't resolve
@cesarferreira @sua8051 Were you able to resolve the issue?
Same here, 403 I couldn't resolve
Thank for your article. I have successfully uploaded to library to GT and can see it. However now my problem is using it in another project. I have created a "read" access PAT and using those details (PAT and username) but can't gte gradle to resolve the dependency. I also get 404 when I try browsing the maven.pkg url I am using for the repositories configuration in gradle :(. Any help?