Create Repository in GitHub using REST API & cURL command

If you don’t know How to create Repository using REST API and cURL in Github? Then this simplified article will help you to learn about creating Repository in Github.

There are two ways to create Repository in Github. First way is using GitHub UI and second one is using GitHubAPI/cURL Lets see first one detail to understand creating repository using API.

Create Repository in GitHub using REST API

Make post call to below URL by passing request body in the form of JSON

Non-Enterprise URL :

Enterprise URL :https:/{hostname}/api/v3/orgs/{ORG_NAME}/repos

Request Body :


Example :


Create Repository in GitHub using cURL command

Creating repository using cURL command is use full when you don’t want to use  GitHub UI or REST API. And also useful  for automation. You can execute cURL command from code or using Jenkin job.

Non-Enterprise URL :

curl -I -u “USERNAME:PASSWORD” “{\"name\":\"REPO_NAME\",\"description\":"DESCRIPTION\",\"homepage\":\"\",\"private\":false }”

Enterprise :

curl -I -u  “USERNAME:PASSWORD” https:/{hostname}/api/v3/orgs/{ORG_NAME}/repos-d              “{\"name\":\"REPO_NAME\",\"description\":"DESCRIPTION\",\"homepage\":\"https:/{hostname}.com\",\"private\":false }”

3 thoughts on “Create Repository in GitHub using REST API & cURL command

  • I was recommended this blog by my cousin. I am no longer certain whether this publish is written via him as no one else
    recognise such unique about my difficulty. You’re incredible!
    Thank you!

  • Your mode of explaining all in this piece of writing is
    in fact nice, every one be capable of easily be aware of it, Thanks a lot.

  • Like!! Thank you for publishing this awesome article.

Comments are closed.