Casey
Casey

Reputation: 552

Permissions to Create GitHub Repo via API

I am creating a web application to create a private Github repo for the user. I followed the instructions to create a Github App and use it to create a UAT via these instructions. In my Github App, I do not see permissions for repo which is required according to this doc.

In my Github App used for creating a UAT, I have enabled read and write Repository permissions for Administration, Contents, Custom Properties, Environments, and Projects. However, my POST request to /user/repos with the user's UAT returns an error response:

{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/repos/repos#create-a-repository-for-the-authenticated-user",
  "status": "403"
}

How can I fix my permissions to create a private repository for the user via UAT?

Upvotes: 0

Views: 33

Answers (1)

Casey
Casey

Reputation: 552

I achieved expected behavior by using an Oauth app instead of a Github app. I was able to create a repo via POST request with UAT after installing the app via Developer settings, Edit the app, then Install App. I will have to test with a new account to see if any account can have a repo created after authorizing, or if they must also Install App.

Upvotes: 0

Related Questions