Difference between revisions of "Git Tips"

From IARC 207 Wiki
Jump to navigation Jump to search
imported>Brjohnson6
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Outline'''
+
==Some Online Resources:==
 +
As specific questions come up you'll find more stuff via searching, I'm sure.<br>
 +
http://try.github.com/levels/1/challenges/1<br>
 +
http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History<br>
 +
http://rogerdudler.github.com/git-guide/<br>
 +
http://ndpsoftware.com/git-cheatsheet.html<br>
 +
http://git-scm.com/downloads<br>
 +
http://www.sbf5.com/~cduan/technical/git/git-1.shtml
 +
https://tiredblogger.wordpress.com/2009/11/09/creating-local-git-repositories-yeah-its-that-simple/
  
:Location of DataPro on GitHub
+
==Settings More Global / General in Nature ==
 +
Set up your name/ email address type stuff:
 +
$ git config --global user.email "me@here.com"
 +
$ git config --global user.name "Bob"
 +
To prevent tracking of extraneous dot files, pycs etc etc, it's a good idea to add a .gitignore to your root git directory... or supply one to your global settings.  To set up a per-repo one, find the text appropriate to your repository here:<br>
 +
https://github.com/github/gitignore<br>
 +
e.g.<br>
 +
https://github.com/github/gitignore/blob/master/Perl.gitignore<br>
 +
https://github.com/github/gitignore/blob/master/Python.gitignore<br>
 +
https://github.com/github/gitignore/blob/master/R.gitignore<br>
 +
https://github.com/github/gitignore/blob/master/Global/Linux.gitignore<br>
 +
https://github.com/github/gitignore/blob/master/Global/OSX.gitignore<br>
 +
https://github.com/github/gitignore/blob/master/Global/Windows.gitignore<br>
 +
Then, using a text editor, write these to a .ignore file in the root repo directory.  Alternately, you can do the same on a global basis (i.e. for all of the git projects on your computer):
 +
$ gedit ~/.global_ignore &
 +
[Paste in content from the links above & save]
 +
$ git config --global core.excludesfile ~/.global_ignore
 +
If you screw up and add the wrong files to your project by accident in the initial setup, you can remove them like this:
 +
$ git rm *.pyc
 +
$ git rm --cached *.pyc
 +
$ git commit -am 'Accidentally added an excluded file type.. did not have .ignore configured yet' 
 +
Then, check to see they're now excluded by listing all the files in version control:
 +
$ git ls-tree -r master --name-only
  
:To download Git
+
Quick overview of commits that have been made:
 +
$ git log --pretty=format:"%h - %an, %ar : %s"
 +
8d8befa - Frank, 11 hours ago : relative paths set up for the initial configs
 +
1e0b20d - Frank, 17 hours ago : Initial commit of the super simple test run supplied by Scott.
  
:To use Git from Aptana Studio 3
+
Oh, also, if you don't want to use ''nano'' as your default text editor here are another couple of options:
 +
$ git config --global core.editor "gedit"
 +
$ git config --global core.editor "vim"
 +
$ git config --global core.editor "mate -w"
  
:To install Git Bash for Windows
+
==Getting down to business with setting up and using a particular repository (Basic Usage)==
 +
Now, let's set up a local repository and a remote one to push to / share with others.<br>
 +
First, set up your local repo:
 +
$ cd /path/to/directory_to_enable_git_in/
 +
$ git init
 +
$ git add *
 +
$ git commit -am "first commit"
  
:Some useful Git Bash commands
 
  
:To deal with creating keys and using them with GitHub
+
Next, set up a remote repository when you already have an existing one... in this case, the remote is in another folder, like a dropbox share:
 +
e.g.<br>  http://stackoverflow.com/questions/1960799/using-gitdropbox-together-effectively
 +
$ cd ~/Dropbox/bob_n_bob/git/
 +
$ git init --bare erode_utilities.git
 +
$ cd ~/path/to/local_repo/
 +
$ git remote add origin ~/Dropbox/bob_n_bob/git/erode_utilities.git
 +
$ git remote set-url origin ~/Dropbox/bob_n_bob/git/erode_utilities.git
 +
$ git push -u origin master
  
:Bob's Git Command Notes
+
Say you typo the previous set up or your remote has a new location, you can change no problem from git:<br>
 +
http://stackoverflow.com/questions/2432764/how-to-change-a-remote-repository-uri-using-git
 +
$ git remote add origin ~/dropbox/bob_n_bob/git/erode_clubfooted_typos_in_here.git  # oops!
 +
$ git remote set-url origin ~/dropbox/bob_n_bob/git/erode_correct_utilities.git      # this command corrects for the previous error
 +
$ git push -u origin master                                                          # now you can push your local repo to the remote.
  
:Git CheatSheet
 
  
:Additional Git commands
+
Push local repo to your remote one (in this case, remote is a dropbox share):
 +
$ git push ~/Dropbox/bob_n_bob/git/busey_erode_inputs.git master
  
:Warning
+
Now, say you are just starting out sharing a codebase with someone.  In the past you've each had independent repositories.  Now however, you'd like to combine them and your partner has already initialized the shared remote repo... 
 +
$ git push ~/Dropbox/bob_n_bob/git/framework.git master
 +
'''Ooops!'''
 +
To /Users/bob/Dropbox/bob_n_bob/git/Framework.git
 +
    ! [rejected]        master -> master (non-fast-forward)
 +
  error: failed to push some refs to '/Users/bob/Dropbox/bob_n_bob/git/Framework.git'
 +
  hint: Updates were rejected because the tip of your current branch is behind
 +
  hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
 +
  hint: before pushing again.
 +
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
 +
So:
 +
$ git fetch origin
 +
From /Users/bob/Dropbox/bob_n_bob/git/Framework
 +
* [new branch]      master    -> origin/master
 +
No problem there.  Now let's try pulling the rest:
 +
$ git pull origin master
 +
    U    Erode3_Jan_2013/erode_base.py
 +
    U    framework.py
 +
Pull is not possible because you have unmerged files.
 +
Please, fix them up in the work tree, and then use 'git add/rm <file>'
 +
as appropriate to mark resolution, or use 'git commit -a'.
 +
So, time to fire up the mergetool to sort this out:
 +
$ git mergetool
 +
  Merging:
 +
    Erode3_Jan_2013/erode_base.py
 +
    framework.py
 +
This may / should bring up a windowed diff manager to allow you to select which changes to accept... if it doesn't, install one:
 +
# aptitude install meld
 +
Next... commit the merged conflict fixes:
 +
$ git commit -m "rectified merge conflicts"
 +
$ git push origin master
 +
Should be golden.  Here's one place for more info:
 +
http://stackoverflow.com/questions/161813/how-do-i-fix-merge-conflicts-in-git
  
:Create repository
+
==Yet to be fleshed out but probably of use==
 +
I haven't gotten to it yet but I am guessing that when it comes to configuration files in the repositories where there are absolute paths, which vary by user, filtering using ''gitattributes'' will be the solution:
 +
http://man.he.net/man5/gitattributes
 +
Maybe something like this (although I suspect there is more to it):
 +
* Add to ''.gitattributes'':
 +
Test_erode_global.cfg filter=in_directory
 +
Test_erode_global.cfg fileter=out_directory
 +
* Then, in .git/config add something like:
 +
[filter "in_directory"]
 +
        clean = indent
 +
        smudge = cat
 +
I'm sort of leaving this incomplete for the moment but basically that link is a good starting point and I'll try to do implement myself.  I also remember Ken suggesting I do something like this for CR basic programs.  So, I might implement that, couldn't hurt.
  
:Awesome conceptual Git website
+
==Incorporating Github as a remote repository==
  
:To upload new project to GITHUB from Aptana Studio 3
+
To deal with creating keys and using them with GitHub:<br>
-------------------------------------------------------------------------------------
+
https://help.github.com/articles/generating-ssh-keys<br>
<nowiki>
 
#Location of DataPro on GitHub:
 
[https://github.com/frankohanlon/DataPro]
 
  
#To download Git:
+
If you're using Github... and you mess up, post some private data (people pushing private keys to github was in the news in 2012 I think)<br>
[http://git-scm.com/downloads]
+
https://help.github.com/articles/remove-sensitive-data<br>
  
To use Git from Aptana Studio 3:
 
First (from Mozilla Firefox, not IE) install Aptana Studio 3:
 
http://www.aptana.com/products/studio3/download
 
Note that after installing Aptana Studio 3, it will have to be
 
        configured to use Pydev:
 
 
</nowiki>
 
:a) Under the windows menu in Aptana Studio, select preferences <br/> :then        select the python interpreter.
 
:b) Under the windows menu in Aptana Studio, select Open Perspective, then other, <br/> :then pyDev
 
:c) Keys will have to be created in the Git Bash window.
 
:d) From the GitBash window, git init will need to be run from the desired workspace <br/> :directory
 
:e) also some Git configuring will be required from the Git Bash window:
 
<br/> ::git config --global user.email "me@here.com"
 
:f) git config --global user.name "Your Name Comes Here"
 
:g) Also numPy will need to be installed from:
 
<br/> :[http://sourceforge.net/projects/numpy/files/NumPy/]
 
 
 
To work on and download an existing project from GitHub:
 
<br/> right-click on the PyDev Package Explorer, select the “Import”  option, and in <br/> the “URI” box that pops up, paste the DataPro from GitHub link:
 
<br/> ::git@github.com:frankohanlon/DataPro.git
 
<br/> (the other box should automatically fill up with corresponding text)
 
  
To use/locate git commands from Aptana Studio 3:
+
-------------------------------------------------------------------------------------
Right-click on the project, select Team and then the appropriate Git command.
+
==Windows Specific Notes==
 
+
To use Git from Aptana Studio 3:<br>
 
+
* (from Mozilla Firefox, not IE) install Aptana Studio 3:
To install Git Bash for Windows:
+
** http://www.aptana.com/products/studio3/download
:http://msysgit.github.com/
+
* Note that after installing Aptana Studio 3, it will have to be configured to use Pydev:
 
+
** Under the windows menu in Aptana Studio, select ''preferences'' then select the ''python interpreter''.
Once Git Bash is installed, the default editor can be changed to notepad:
+
** Under the windows menu in Aptana Studio, select ''Open Perspective'', then ''other'', then ''yDev''
$ git config --global core.editor notepad
+
** Keys will have to be created in the Git Bash window.
+
** Also from the GitBash windowgit init will need to be run from the desired workspace directory
 
+
** Some git configuring will be required from the Git Bash window (as shown above in the general git section):
Some useful Git Bash commands:
+
*** git config --global user.email "me@here.com"
 
+
*** git config --global user.name "Your Name Comes Here"
$explorer .   opens  current directory folder from windows explorer
+
* To work on and download existing project from GitHub:
$explorer~  opens  home directory folder from windows explorer
+
** right-click on the PyDev Package Explorer, select the “Import” option, and in the “URI” box that pops up, paste the DataPro from GitHub link:
$pwd  location of present working directory
+
*** ''git@github.com:frankohanlon/DataPro.git'' (the other box should automatically fill up with corresponding text)
$cd .. up a directory
+
* To use/locate git commands from Aptana Studio 3:
$./ name.bat (runs a batch file named “name.bat”)
+
** Right-click on the project, select Team and then the appropriate Git command.
$vim name_of_file  Opens up the vim editor
+
* To upload new project to GITHUB from Aptana Studio 3:<br>
(type escape, then  :wq to get out of the vim editor)
+
** (The following directions are modified from: https://aptanastudio.tenderapp.com/discussions/questions/1219-aptana-and-github )
$cat name_of_file lists contents of file
+
# Create a new project
$cat name_of_file|more list contents of file page by page
+
# Right-click on project..."Team > Share Project". Commit your local contents to that repo
$touch name_of_file creates a new empty file named name_of_file
+
# Create a new Github repo
$git --version indicates the version of git
+
# From Aptana studio,  right-click "Add remote" and paste in the URL of your project<br\>(Team-> Remotes-->Add Remote)  
 
+
# $ git status
 
+
# $ git add src/
 
+
# You have to follow up with  one manual step ATM. Type "git push -u origin master" in the console for the project
To deal with creating keys and using them with GitHub:
+
# You can now push your files up to Github.
 
 
https://help.github.com/articles/generating-ssh-keys
 
 
 
Hint: just press return when asked:
 
Enter file in which to save the key:
 
Enter passphrase (empty for no passphrase):
 
 
 
 
 
Bob's Git Command Notes:
 
$git status
 
$git commit -a //This only adds and commits modified files, not the new ones
 
$git push git@github.com:frankohanlon/DataPro-for-Windows master
 
$git push git@github.com:frankohanlon/DataPro master
 
 
 
$diff DataPro/datapro.py DataPro/datapro.py
 
$git remote add origin git@github.com:frankohanlon/DataPro_Sample_Files.git
 
$git push git@github.com:frankohanlon/DataPro_Sample_Files.git
 
 
 
Git CheatSheet:
 
Click between the narrow vertical lines to see what commands are available from state to state.
 
 
 
http://ndpsoftware.com/git-cheatsheet.html
 
 
 
 
 
Additional Git commands:
 
$gitk Visualize branch history, commits
 
$git diff between working directory
 
$git diff --cached between added and previous commit
 
$git add filename
 
$git add filename1 filename2
 
$git commit -m 'some silly message'  -m stands for message
 
$git log
 
$git pull [remote name] merges what is pulled in
 
$git fetch [remote name] does not merge what is fetched.
 
The following will NOT work with Github:
 
$git clone git://github.com:bryanj007/NewTutorial.git
 
creates NewTutorial folder in the current directory with files in it from GitHub
 
$git clone git://github.com:bryanj007/NewTutorial.git funky
 
creates funky folder in the current directory with files in it from GitHub  
 
NewTutorial project
 
 
 
Solution to clone issue:
 
$git clone git@github.com:bryanj007/NewTutorial.git
 
        creates NewTutorial folder in the current directory with files in it from GitHub
 
 
 
If accidentally use git protocol, will need to change URL of origin:
 
git remote set-url origin git@github.com:my_user_name/my_repo.git
 
 
 
OR since git protocol not supported in GITHUB:
 
 
 
in .git/config file:
 
can make the following change:
 
 
 
before:
 
[remote "origin"]
 
    fetch = +refs/heads/*:refs/remotes/origin/*
 
    url = git://github.com/my_user_name/my_repo.git
 
 
 
after:
 
[remote "origin"]
 
    fetch = +refs/heads/*:refs/remotes/origin/*
 
url = git@github.com:my_user_name/my_repo.git
 
 
 
 
 
 
 
Warning:
 
 
 
It's somewhat difficult to remove files and folders from repository once posted to GITHUB
 
Nevertheless, here's how to do it:
 
https://help.github.com/articles/remove-sensitive-data
 
 
 
 
 
 
 
Create repository:
 
mkdir [project]
 
cd [project]
 
git init //This creates a .git directory in the project folder
 
 
 
 
 
Awesome conceptual Git website:
 
http://www.sbf5.com/~cduan/technical/git/git-1.shtml
 
 
 
What is in a commit object?
 
It has a pointer to the parent commit
 
Contains a set of files, reflecting project's state at a given time.
 
Contains a 40-character SHA1 name
 
 
 
 
 
 
 
 
 
 
 
Additional Possible Aptana Studio 3 Problem:
 
 
 
 
To upload new project to GITHUB from Aptana Studio 3:
 
The following directions modify/are from:
 
https://aptanastudio.tenderapp.com/discussions/questions/1219-aptana-and-github
 
Basically, you follow this process:
 
1)Create a new project
 
 
2) Right-click on project..."Team > Share Project". Commit your local contents to that repo
 
 
 
3) Create a new Github repo
 
 
4)From Aptana studio,  right-click "Add remote" and paste in the URL of your project
 
(Team-> Remotes-->Add Remote) This creates origin in GitHub I think.
 
4.5) git status
 
4.75) git add src/
 
 
5) You have to follow up with  one manual step ATM. Type "git push -u origin master"  
 
in the console for the project
 
 
 
6) You can now push your files up to Github.
 
 
 
 
 
Between steps 5 and 6:
 
 
I once had a weird error..The error message was something like this:
 
 
 
error: src refspec master does not match any.
 
error: failed to push some refs to 'git@github ... .git'
 
  
and it was solved by executing the following commands:
+
Notes from Bryan:
$ touch README
+
I once had a weird error..The error message was something like this:
$ git add README
+
:error: src refspec master does not match any.
$ git add (all other files)
+
:error: failed to push some refs to 'git@github ... .git'
$ git commit -m 'reinitialized files'
+
It was solved by executing the following commands:
$ git push origin master --force
+
:$ touch README
 +
:$ git add README
 +
:$ git add (all other files)
 +
:$ git commit -m 'reinitialized files'
 +
:$ git push origin master --force

Latest revision as of 12:43, 28 February 2013

Some Online Resources:

As specific questions come up you'll find more stuff via searching, I'm sure.
http://try.github.com/levels/1/challenges/1
http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History
http://rogerdudler.github.com/git-guide/
http://ndpsoftware.com/git-cheatsheet.html
http://git-scm.com/downloads
http://www.sbf5.com/~cduan/technical/git/git-1.shtml https://tiredblogger.wordpress.com/2009/11/09/creating-local-git-repositories-yeah-its-that-simple/

Settings More Global / General in Nature

Set up your name/ email address type stuff:

$ git config --global user.email "me@here.com"
$ git config --global user.name "Bob"

To prevent tracking of extraneous dot files, pycs etc etc, it's a good idea to add a .gitignore to your root git directory... or supply one to your global settings. To set up a per-repo one, find the text appropriate to your repository here:
https://github.com/github/gitignore
e.g.
https://github.com/github/gitignore/blob/master/Perl.gitignore
https://github.com/github/gitignore/blob/master/Python.gitignore
https://github.com/github/gitignore/blob/master/R.gitignore
https://github.com/github/gitignore/blob/master/Global/Linux.gitignore
https://github.com/github/gitignore/blob/master/Global/OSX.gitignore
https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
Then, using a text editor, write these to a .ignore file in the root repo directory. Alternately, you can do the same on a global basis (i.e. for all of the git projects on your computer):

$ gedit ~/.global_ignore & 
[Paste in content from the links above & save]
$ git config --global core.excludesfile ~/.global_ignore

If you screw up and add the wrong files to your project by accident in the initial setup, you can remove them like this:

$ git rm *.pyc
$ git rm --cached *.pyc
$ git commit -am 'Accidentally added an excluded file type.. did not have .ignore configured yet'   

Then, check to see they're now excluded by listing all the files in version control:

$ git ls-tree -r master --name-only

Quick overview of commits that have been made:

$ git log --pretty=format:"%h - %an, %ar : %s"
8d8befa - Frank, 11 hours ago : relative paths set up for the initial configs
1e0b20d - Frank, 17 hours ago : Initial commit of the super simple test run supplied by Scott.

Oh, also, if you don't want to use nano as your default text editor here are another couple of options:

$ git config --global core.editor "gedit"
$ git config --global core.editor "vim"
$ git config --global core.editor "mate -w"

Getting down to business with setting up and using a particular repository (Basic Usage)

Now, let's set up a local repository and a remote one to push to / share with others.
First, set up your local repo:

$ cd /path/to/directory_to_enable_git_in/
$ git init
$ git add *
$ git commit -am "first commit"


Next, set up a remote repository when you already have an existing one... in this case, the remote is in another folder, like a dropbox share: e.g.
http://stackoverflow.com/questions/1960799/using-gitdropbox-together-effectively

$ cd ~/Dropbox/bob_n_bob/git/
$ git init --bare erode_utilities.git
$ cd ~/path/to/local_repo/
$ git remote add origin ~/Dropbox/bob_n_bob/git/erode_utilities.git
$ git remote set-url origin ~/Dropbox/bob_n_bob/git/erode_utilities.git
$ git push -u origin master

Say you typo the previous set up or your remote has a new location, you can change no problem from git:
http://stackoverflow.com/questions/2432764/how-to-change-a-remote-repository-uri-using-git

$ git remote add origin ~/dropbox/bob_n_bob/git/erode_clubfooted_typos_in_here.git   # oops!
$ git remote set-url origin ~/dropbox/bob_n_bob/git/erode_correct_utilities.git      # this command corrects for the previous error
$ git push -u origin master                                                          # now you can push your local repo to the remote.


Push local repo to your remote one (in this case, remote is a dropbox share):

$ git push ~/Dropbox/bob_n_bob/git/busey_erode_inputs.git master

Now, say you are just starting out sharing a codebase with someone. In the past you've each had independent repositories. Now however, you'd like to combine them and your partner has already initialized the shared remote repo...

$ git push ~/Dropbox/bob_n_bob/git/framework.git master

Ooops!

To /Users/bob/Dropbox/bob_n_bob/git/Framework.git
    ! [rejected]        master -> master (non-fast-forward)
 error: failed to push some refs to '/Users/bob/Dropbox/bob_n_bob/git/Framework.git'
 hint: Updates were rejected because the tip of your current branch is behind
 hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
 hint: before pushing again.
 hint: See the 'Note about fast-forwards' in 'git push --help' for details.

So:

$ git fetch origin
From /Users/bob/Dropbox/bob_n_bob/git/Framework
* [new branch]      master     -> origin/master

No problem there. Now let's try pulling the rest:

$ git pull origin master
   U    Erode3_Jan_2013/erode_base.py
   U    framework.py
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

So, time to fire up the mergetool to sort this out:

$ git mergetool
  Merging:
    Erode3_Jan_2013/erode_base.py
    framework.py

This may / should bring up a windowed diff manager to allow you to select which changes to accept... if it doesn't, install one:

# aptitude install meld

Next... commit the merged conflict fixes:

$ git commit -m "rectified merge conflicts"
$ git push origin master

Should be golden. Here's one place for more info: http://stackoverflow.com/questions/161813/how-do-i-fix-merge-conflicts-in-git

Yet to be fleshed out but probably of use

I haven't gotten to it yet but I am guessing that when it comes to configuration files in the repositories where there are absolute paths, which vary by user, filtering using gitattributes will be the solution: http://man.he.net/man5/gitattributes Maybe something like this (although I suspect there is more to it):

  • Add to .gitattributes:
Test_erode_global.cfg filter=in_directory
Test_erode_global.cfg fileter=out_directory
  • Then, in .git/config add something like:
[filter "in_directory"]
       clean = indent
       smudge = cat

I'm sort of leaving this incomplete for the moment but basically that link is a good starting point and I'll try to do implement myself. I also remember Ken suggesting I do something like this for CR basic programs. So, I might implement that, couldn't hurt.

Incorporating Github as a remote repository

To deal with creating keys and using them with GitHub:
https://help.github.com/articles/generating-ssh-keys

If you're using Github... and you mess up, post some private data (people pushing private keys to github was in the news in 2012 I think)
https://help.github.com/articles/remove-sensitive-data



Windows Specific Notes

To use Git from Aptana Studio 3:

  • (from Mozilla Firefox, not IE) install Aptana Studio 3:
  • Note that after installing Aptana Studio 3, it will have to be configured to use Pydev:
    • Under the windows menu in Aptana Studio, select preferences then select the python interpreter.
    • Under the windows menu in Aptana Studio, select Open Perspective, then other, then yDev
    • Keys will have to be created in the Git Bash window.
    • Also from the GitBash window, git init will need to be run from the desired workspace directory
    • Some git configuring will be required from the Git Bash window (as shown above in the general git section):
      • git config --global user.email "me@here.com"
      • git config --global user.name "Your Name Comes Here"
  • To work on and download existing project from GitHub:
    • right-click on the PyDev Package Explorer, select the “Import” option, and in the “URI” box that pops up, paste the DataPro from GitHub link:
      • git@github.com:frankohanlon/DataPro.git (the other box should automatically fill up with corresponding text)
  • To use/locate git commands from Aptana Studio 3:
    • Right-click on the project, select Team and then the appropriate Git command.
  • To upload new project to GITHUB from Aptana Studio 3:
  1. Create a new project
  2. Right-click on project..."Team > Share Project". Commit your local contents to that repo
  3. Create a new Github repo
  4. From Aptana studio, right-click "Add remote" and paste in the URL of your project<br\>(Team-> Remotes-->Add Remote)
  5. $ git status
  6. $ git add src/
  7. You have to follow up with one manual step ATM. Type "git push -u origin master" in the console for the project
  8. You can now push your files up to Github.

Notes from Bryan:

I once had a weird error..The error message was something like this:
:error: src refspec master does not match any.
:error: failed to push some refs to 'git@github ... .git'
It was solved by executing the following commands:
:$ touch README
:$ git add README
:$ git add (all other files)
:$ git commit -m 'reinitialized files'
:$ git push origin master --force