My Awesome Post

$ git-init

Github is a distributed revision control system that I use to track my work. Really though Github is so much more. I am taking the time today to briefly cover how to initialize a new repo for Github. This will walk through the first couple of commands that are used to kick off a project in the beginning.

Here is the official Github help page related to this topic. I don’t find it to particularly useful though since most of the work that I do with Github is by issuing Terminal commands.

If you don’t have Git setup on your local machine you have some one time hoops to jump through before getting started. Go follow these steps. They involve downloading and installing Git, doing a bit of account creation and setup, and lastly getting your connection secured for communicating with Github.

Now, back to creating a new Github repo. First within terminal navigate to the top folder level of the project you wish to create a repo for. From terminal issue this command.

$ git init

You should see a message similar to this.

Initialized empty Git repository in home/developer/public_html/.git

Within that same level of the folders issues the command.

$ git add *

This commands tags all of the files that are to be added when we issue a commit command which is what we shall do next.

$ git commit -m 'first init commit'

You will see a list of the files being committed within your terminal window. When this is all finished up go ahead check in on the status.

$ git status

And this is the message that you should see.

On branch master Untracked files: (use "git add ..." to include in what will be committed)

.project nothing added to commit but untracked files present (use “git add” to track)

Now we need to actually get this tied to the Github site so we can do a push up to repo on Github.com. Here are the steps needed to accomplish that.

Once that new repository is created we need to grab the url for that repo and issued the following commands.

$ git remote add origin ADDRESS_OF_REMOTE_REPO

$ git push -u origin-master

There we go. We now have a new working git repo. Good times. Here is a listing of just the commands that we used.

$ git init $ git add * $ git commit -m 'first init commit' $ git remote add ADDRESS_OF_REMOTE_REPO $ git push -u origin-master

Written on October 13, 2014