Skip to content

Instantly share code, notes, and snippets.

@rokibhasansagar
Last active October 28, 2021 17:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rokibhasansagar/c11adff6780df2f00e2a054ff737f479 to your computer and use it in GitHub Desktop.
Save rokibhasansagar/c11adff6780df2f00e2a054ff737f479 to your computer and use it in GitHub Desktop.

User Account:

Replace ACCESS_TOKEN with Git OAuth Token and NEW_REPO_NAME with your New Repository Name in the command below:

curl -H "Authorization: token ACCESS_TOKEN" -d '{"name": "NEW_REPO_NAME", "private": <true/false>, "description": "<add_a_little_info_about_the_repo>"}' https://api.github.com/user/repos

Or like...

curl -i -X POST https://api.github.com/user/repos \
-H "Authorization: token <ACCESS_TOKEN>" \
-d @- << EOF
{
  "name": "<NEW_REPO_NAME>",
  "auto_init": true,
  "private": <true/false>,
  "description": "<add_a_little_info_about_the_repo>"
}
EOF

Organisation:

curl -H "Authorization: token ACCESS_TOKEN" -d '{"name": "NEW_REPO_NAME"}' https://api.github.com/orgs/ORGANISATION_NAME/repos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment