Basic Git and GitHub usage

By | 30 August, 2013

Leaving this here for all the people that want to get up and running with Git and GitHub in around 56 seconds.

This mini tutorial assumes you already have:

– a linux machine with git OR a windows machine with git installed (see links);
– a github account/repo for the remote commits (see bottom links for help on this);
– a love of zombies – not really necessary but it helps.

Off we go, read on.


Create a directory with the source codes of your project

Open a terminal/git bash on it, or/and navigate to the dir, and do this:

to setup the git files:

$ git init

to creates a file called README (optional but not really):

$ touch README

to stage the README. this adds it to the list of files to be commited eventually:

$ git add README

same as above, but for all the .py files, be criative to add your own files:

$ git add *.py

to commit your files, with the message between quotes:

$ git commit -m 'my awesome first commit'

this next command is for a remote commit, and creates a remote named “origin” pointing at your hub repository. Be sure to change [username] for your username and [my-project] by, well, your project name (remove the brackets on both):

$ git remote add origin https://github.com/[username]/[myproject].git

to send your commits in the master branch to GitHub:

$ git push origin master

Go to your github account/project and smile.

Go read and get smarter, theres really a lot of fun stuff to learn:

GitHub help article about creating a repo

Git Downloads

Git documentation

Git reference (great read)