'Cookies must be enabled to use GitHub

I have made a GitHub action in which I am having my dockerfile as :

FROM alpine:latest

RUN apk update

RUN apk --no-cache add curl git python3 py3-pip

COPY entrypoint.sh /entrypoint.sh

RUN ["chmod", "+x", "/entrypoint.sh"]

ENTRYPOINT ["/entrypoint.sh"]

In the entrypoint.sh I am using curl to request the GitHub API to change one repo's default branch. the command I am using is :

curl -i -u "$USER_NAME:$GITHUB_KEY" --request PATCH -d '{"default_branch": "master"}' https://api.github.com/repos/$USER_NAME/$REPO_NAME

Everything is Well Defined.

But in the response I am getting :

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    74    0    38  100    36    255    241 --:--:-- --:--:-- --:--:--   496

HTTP/2 403 
server: GitHub.com
date: Wed, 23 Feb 2022 07:20:13 GMT
content-type: text/plain; charset=utf-8
vary: X-PJAX, X-PJAX-Container
permissions-policy: interest-cohort=()
cache-control: no-cache
set-cookie: _gh_sess=%2BEichIQiS6mPGOQezauQXt5LDjh8PQrowD3A5%2FzFXiDuXxvgFxJViurljc6uElUDKarOEnWSLlxeDz0RmL4MCusqQMitCn4v2UFd4IQ%3D%3D--QEwYz3UHkEiL1NGR--jjbCBNRKQEQOA%3D%3D; path=/; secure; HttpOnly; SameSite=Lax
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
expect-ct: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
content-security-policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com objects-origin.githubusercontent.com www.githubstatus.com collector.githubapp.com collector.github.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events translator.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src render.githubusercontent.com viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com collector.github.com github-cloud.s3.amazonaws.com secured-user-images.githubusercontent.com/ *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/
vary: Accept-Encoding, Accept, X-Requested-With
x-github-request-id: 07C7:12E1:C19D08:14B9C02:6215E02D

Cookies must be enabled to use GitHub.

I am not getting out to get out of it.

Please help me to get out of it. or please tell me any way using git to change default branch of a repo.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source