The Git, The Hub, And The  Ugly

May 17, 2013

It’s funny how your opinion’s can change. I didn’t like GitHub when I first signed up for a few good reasons.

  • It sucked on Windows.
  • There was no single good source about how to use GitHub on Linux

Even the Github help pages weren’t that useful unless you manage to piecemeal it all together (which I eventually did). I must admit though, now that I know how to use GitHub on Linux, It’s amazing. It’s seriously one of the most useful tools that a software developer could use for version control and forking others code. I am a big fan of this open source movement. So in order to help all you wary travellers out there who want to become a part of this, let me blaze a single trail here where you can refer back to the basics of using the git command and GitHub.

Before we start make sure you have git installed. If your using a Debian based operating system it might already be installed.. I’m using Mint which you can check out here. If not, the easiest way to do this is to type the following into the terminal.

1    apt-get install git

Then to configure it type

1    git config --global user.name [usernamehere]

and

1    git config --global user.email [emailhere]

The first line installs git and the next two just configure the settings to remember your name and email.

Now is when we can actually go ahead and start using GitHub. Login and create a new repository.

Once a new repository is created, clone that repository onto your computer by entering

1    git clone https://repository_address_here

into the terminal.

CD into your new repository

1   cd ~/new_repository

Now you can add things to that directory from your project. Once new files are added to the directory and your ready to upload type

1    git add --all

which will prepare GitHub for all the new files you’ve just added.

Next you want to commit your updated directory, type

1    git commit -m "Commit Message"

Finally push ( upload ) the directory back to GitHub

1    git push origin master

If you’re pushing to a different branch, like Github Pages, then just type

1    git push origin [branchname]

That’s really all you need to know to get started. So go get coding, you could even fork this blog from my github page (that’s like creating a new repository).

Word of the day: pithy
Quote of the day:

Either write something worth reading or do something worth writing.

-Benjamin Franklin

← Graduation What I've Learned So Far →
Written and Published by Matt Sheehan
Fast learner, amateur coffee drinker, good guy, programmer.
Mostly in that order.