August 16, 2018

Create new Github repository, no mouse required.

How to quickly create new Github project from your command line.

Use gh-utils

git clone git@github.com:agilecreativity/gh-utils.git && cd gh-utils

# Then install it
lein deps :tree && lein bin

# Source the appropriate shell
source ~/.zshrc # or source ~/.bashrc

# Then see if we can use the project
ls ~/bin/gh-utils

# See the sample usage
gh-utils

Basic Usage

  • First create the basic config that have your Github login/credentials
;; e.g. store this in the known location like ~/Dropbox/config/github.edn
{:username "<your-github-username>"
 :password "<your-github-password>"
}
  • The basic usage
Usage: gh-utils [options]
  -c, --config CONFIG              ~/Dropbox/config/github.edn
  -r, --repo REPO
  -i, --init-commit
  -l, --remote-label REMOTE_LABEL  origin
  -p, --push
  -h, --help

Options:

--config       CONFIG       full path to the config file e.g. ~/Dropbox/config/github.edn
--init-commit               run git-init and git commit on the local project
--repo         REPO         name of repository to be created
--remote-label REMOTE_LABEL remote label default to 'origin'
--push                      push the code to the remote repository as well

Examples:

a) To push existing project that have already contain some commit (e.g. skip -i)
gh-utils -c ~/Dropbox/config/github.edn -r awesome-idea -l upstream -p

b) To create and push brand new project to Github and run initial commit
gh-utils -c ~/Dropbox/config/github.edn -r awesome-idea -i -l origin -p

c) To create brand new project to Github, run initial commit and skip pushing to remote branch.
gh-utils -c ~/Dropbox/config/github.edn -r awesome-idea -i -l origin

See official readme.md for details.

Tags: automation clojure