- Make a repository on GitHub. Check the box that says "initialize this repo with a README."
- Clone that repository on to your computer. That's
git clone
+ the ssh URL you can find on the right-hand side of the repository. Go to the directory where you want therepository_name
folder to live. - Run a
git status
as a sanity check. (Everything should be clean). - Write some code!
- Run a
git status
again. See that your code now lives in your repository, but hasn't yet been added to version control. (the file names should be red in your terminal) - "Add" (
git add
) the code to version control. - Run another
git status
. The file names should now be green, meaning they've been added to the version control staging area, but not committed to your repository's history. - Commit your changes with
git commit -m 'message_here'
). - Run another
git status
. It should show that your directory is clean, but that you're ahead of the remote repository (GitHub) by one commit. - Push that commit to GitHub with a
git push
. - Celebrate! You've written code, checked it in to git (version control), and pushed it to GitHub. Most excellent!
Beyond statusing, adding, committing, and pushing, you may also want to know about pulling, branching, reverting, and other such fancy things. I leave these adventures to you! :)
I like this guide for a beginning reference. I also use Stack Overflow very, very often. GitHub help. This git reference manual is also quite excellent (but covers only git, not GitHub or other places you can put your repos online).