Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Received status code 403 from server: Forbidden #2

Open
cesarferreira opened this issue Nov 21, 2019 · 13 comments
Open

Received status code 403 from server: Forbidden #2

cesarferreira opened this issue Nov 21, 2019 · 13 comments
Assignees

Comments

@cesarferreira
Copy link

cesarferreira commented Nov 21, 2019

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!

@prasad79
Copy link
Collaborator

prasad79 commented Nov 21, 2019

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.

cesar-android-id

@prasad79 prasad79 self-assigned this Nov 21, 2019
@cesarferreira
Copy link
Author

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

@prasad79
Copy link
Collaborator

prasad79 commented Nov 22, 2019

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.

@prasad79
Copy link
Collaborator

Please try cloning the project with Https clone and it should work.

@cesarferreira
Copy link
Author

The same happens :/

image

@prasad79
Copy link
Collaborator

  1. 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.
  2. I also noticed that 403 errors is also thrown when the version number of the library is the same on Github
  3. 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.

@prasad79
Copy link
Collaborator

@cesarferreira were you able to resolve this issue?

@cesarferreira
Copy link
Author

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 :)

@prasad79
Copy link
Collaborator

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

@suale-dev
Copy link

Same here, 403 I couldn't resolve

@harishgupta01
Copy link

@cesarferreira @sua8051 Were you able to resolve the issue?

@amirisback
Copy link

Same here, 403 I couldn't resolve

@saintjab
Copy link

saintjab commented Aug 9, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants