Skip to content
A simple way to perform your initial commit to github with a single terminal command
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple way to perform your initial commit to github

What is ghinit?

ghinit is a small bashscript created out of the frustration when you have to perform you initial commit, but you are in a hurry.


Before using ghinit you need to setup a Personal access tokens with the repo access level for your github account and then define the following environment variables:

export GH_USERNAME=MyUsername
export GH_ACCESS_TOKEN=1234mytoken123

If you prefer not adding your token to your environment variables simply create a file called .ghinit in your home directory containing your information


You can now use ghinit simply by running ghinit in your project directory.

ghinit [-cp] [-n reponame] [-d description] [-m commitmsg] [--push]

The options are:

Shorthand Full Description
-c --commit Adds all files and commits them. Additionally warns you if there is no .gitignore present.
-p --private Makes the Github repository a private one.
-n --name Followed by a string, uses that as the name instead of the current directory name.
-d --description Followed by a string, sets the Github repository description.
-m --message Followed by a string, when using -c, sets the commit message to this message. Otherwise, defaults to Init commit.
--push Pushes to Github right after creating it.

Example output:

ghinit ❯ ghinit -d "A simple way to perform your initial commit to github with a single terminal command" -c --push
Setting up github repo ghinit...
Initialized empty Git repository in /Users/daniel/dev/ghinit/.git/
.gitignore doesn't exist, would you still like to commit add all? [Y/n]y
Adding all files...
Commit message (Leave blank for default):
Creating initial commit...
[master (root-commit) 0991a9e] Init commit
 2 files changed, 150 insertions(+)
 create mode 100644
 create mode 100755 ghinit
Counting objects: 4, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.77 KiB | 1.77 MiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
 * [new branch]      master -> master
You can’t perform that action at this time.