Skip to content

Instantly share code, notes, and snippets.

@gullz
Created January 9, 2018 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gullz/64c03c2fe68be97e42bb1cfedd2e578c to your computer and use it in GitHub Desktop.
Save gullz/64c03c2fe68be97e42bb1cfedd2e578c to your computer and use it in GitHub Desktop.
Creating a git repository from command line - Linux
#! /bin/bash
# -------------------------------------------------------------------------- #
# This is a linux shell script, used to create 'github' repository from
# command line.
# Each git server providers provide different APIs for creating repositories
# though, the repository manipulation through git client is same.
# Note: This can be done in windows also but requires curl.
# --------------------------------------------------------------------------- #
# From: https://stackoverflow.com/questions/2423777/is-it-possible-to-create-a-remote-repo-on-github-from-the-cli-without-opening-br
curl -u 'USER.NAME' https://api.github.com/user/repos -d '
{
"name": "Hello-World",
"description": "This is your first repository",
"homepage": "https://github.com",
"private": false,
"has_issues": true,
"has_projects": true,
"has_wiki": true
}'
# Note: note that the 14th line contain an apostrope(') at the end of the line,
# and USER.NAME should be your github user name.
# More information can be found from https://developer.github.com/v3/repos/#create
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment