Github Guide

Just a few pointers / steps / useful commands if you're new to git (ME) and want to maintain a repo of your tilde.town home directory. I may be wrong, might not be best practice or whatever (let me know!), but this works for me :}

  1. First we have to set-up Git.
    git config user.name "username" to add your username (can be whatever), and
    git config user.email "emailaddress" to add the E-mail address you use to log-in to Github.
    (If you want to add SSH or GPG keys you should generate them now and add them via the web interface).
  2. Make sure you're in your home directory (or wherever you want to use as the base for the project)
  3. git init to initialise the repo
  4. Create a readme file and a .gitignore file.
    Your readme can be plain or markdown and should have a little info about the project. You'll have seen a bunch if you've visited Github, they're shown by default when you view a repo's page.
    The gitignore file tells git what you don't and/or do want included in your repository. For example you don't want to make private data like address books and SSH keys public!
    Mine started with /* which excludes everything, than I've told it exactly what I do want added. In my case !bin/(the ! makes it not ignore that directory / file), !public_html/, !publc_gopher/, !.gitignore, !README.md, etc.
    Mine's viewable here BTW.
    Ignoring everything first, rather than ignoring everything individually was just the method that invloved less typing :)
  5. git add . adds everything in your work directory to the queue to go to the repo (called staging). Instead of using a . you can dod it for individual files or w/e.
  6. git commit -m "message" where message is a brief description of what you're changing.
  7. Next you'll need to do some stuff in your browser. Go to Github and create a new empty repository, then copy the remote repository URL.
    git remote add origin PASTEURLHERE to add the location.
    You can do this from the CLI too, but you have to use Github's API and it's kinda clunky.
  8. git push origin master will send off all your changes D:

Some other useful things:

See Also

This little script I made to remind myself of git things: git-reminder

#!/bin/bash

#	Little reminders for mundane git commands

echo '>> git status'
echo '   Get list of files changed but not stages'
echo '>> git add .'
echo '   Stages  everything, considering .gitignore'
echo '   Otherwise specifcy specific files / dirs'
echo '>> git commit -m "message"'
echo '   Commit message to add to pushed files'
echo '>> git push origin master'
echo '   Sends stuff on its way~'