Skip to content

Instantly share code, notes, and snippets.

@jennceng
Last active January 11, 2017 20:36
Show Gist options
  • Save jennceng/f0179dc9b0a80e50852904611e87712b to your computer and use it in GitHub Desktop.
Save jennceng/f0179dc9b0a80e50852904611e87712b to your computer and use it in GitHub Desktop.
Basic Git / Github setup`

Useful resources: https://help.github.com/articles/set-up-git/

Step 1. Check for git on your machine:

In terminal

$ which git

if you get something along the lines of /usr/local/bin/git you have git, otherwise download and set up latest version: go to https://help.github.com/articles/set-up-git/ and follow instructions

Step 2. Get a Github account and setup in terminal

Sign up for a github account, keep your email address and pw in mind for setup (this only has to be done once)

$ git config --global user.name "YOUR NAME"
$ git config --global user.email "YOUR EMAIL ADDRESS"

Step 3. Go to directory you want to push up

In terminal, go to the directory you want to put on github, ie if you're pushing up connect4

$ cd ~/whatever/challenges/connect4

Step 4. Initialize git to start watching your directory

$ git init

Step 5. Check the status of your directory

Any files not yet staged (or if this is not your first commit this will be all files changed since last commit) will appear in red:

$ git status

Step 6. Stage files

This can be one at a time, or if you're certain you want them all you can:

$ git add .

Step 7. Review changes

To review your changes before commiting vis the command line you can:

$ git diff --staged

Step 8. Check your status again

You should see the files you've now staged in green

$ git status

Step 9. Commit your changes

include a message of what you've done in this commit

$ git commit -m "added a board class"

Step 10. Push up to github

To push onto github go to your github page and make a new repo alt

then follow the directions to push up onto github under push an existing repository from the command line (this will be on the page after you've created your directory): alt

for example:

$ git remote add origin https://github.com/jennceng/example_repo.git // this only has to be done for the first push
$ git push -u origin master // will only need this line after first push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment