Step 1: Create a personal access token on GitHub.
Step 2: Update the GitHub repository using REST API
1 2 3 4 5 6 7 8 9 10 11 12 |
## Declare some Variables GITHUB_PAT_TOKEN=' GITHUB_REPO_NAME=' GITHUB_USER_NAME=' ## Make a public GitHub repository private curl \ --request PATCH \ --silent \ --header "Authorization: token $GITHUB_PAT_TOKEN"" \ --data '{"private":"true"}' \ https://api.github.com/repos/$GITHUB_USER_NAME/$GITHUB_REPO_NAME \ |
To get additional details, please refer to the below documentation.
https://docs.github.com/en/rest/repos