0

I'm trying to achieve Github repo transfer (on both private and public repos) via their REST API. For this I have tried the below options

  1. With Github App and Oktokit

    const app = new App({ appId: <App_Id>, privateKey: <Private_Key>, });

    const octokit = await app.getInstallationOctokit(<Installation_Id>);

    let data = await octokit.request("POST /repos/{owner}/{repo}/transfer", { owner, new_owner, new_name })

Error: "Resource not accessible by integration"

  1. Github PAT token and Octokit

    const octokit = new Octokit({auth: "<PAT_Token>"});

    const response = await octokit.rest.repos.transfer({ owner, repo, new_owner });

Error: "Resource not accessible by personal access token"

  1. Tried with Plain curl URL as well; however no luck, similar error response.

For Github App

For Github PAT

I have given all permission for this test drive. no luck!

Am I missing anything here? I would appreciate any help on this.

Muthu Thavamani
  • 1,325
  • 9
  • 19
  • git repo transfer api: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#transfer-a-repository – Muthu Thavamani Jul 03 '23 at 10:32
  • this might very well be an API problem. I'd try https://github.com/orgs/community/discussions/categories/api-and-webhooks as some Hubbers are watching over there. Did you try to with another another repository / org? – Gregor Jul 03 '23 at 22:45
  • yes I tried with different repos; even tried after changing their visibility as well. still same issue. – Muthu Thavamani Jul 04 '23 at 04:49
  • Github community discussion ref: https://github.com/orgs/community/discussions/60014 – Muthu Thavamani Jul 04 '23 at 07:05
  • The repo transfer is working with classic PAT token; not with fine-grained tokens. – Muthu Thavamani Jul 04 '23 at 14:54
  • Can you clarify your question about classic vs fine-grained PAT. At least to me, that is an important distinction. The classic PAT is an OAuth token, the fine-graned PAT works similarly to how GitHub Apps and GitHub Actions authenticate. – Gregor Jul 05 '23 at 16:56

0 Answers0