Skip to content

Instantly share code, notes, and snippets.

@keum
Last active December 24, 2015 10:09
Show Gist options
  • Save keum/6781813 to your computer and use it in GitHub Desktop.
Save keum/6781813 to your computer and use it in GitHub Desktop.
Command line git usage
Using GitHub
1.Sign up for Github - make yourself an account with a cool name!
2. Start - from your GitHub account, create a new repositiories by clicking Tab then click "New" green button. Or you can "fork" (dirty sounding, isn't it?) from someone elses page. This is like making your own copy. Under this Repository, you can create multiple files by clicking plus button next to your repository(folder) name.
3. Give a name that will becomes your repository(repo), equalvent to "directory folder in explorer".
4. After creating account and repository, you need to download actual git in your local machine or you can start with the link.
-> https://help.github.com/articles/set-up-git
I used windows - I'm on Windows 7. I accepted the default except I selected the preference to run everything through the Windows cmd prompt.
4.In my /user/<username> folder I made another folder called "github." - this is where your Github work will be done. If you want to work from somwhere else this is a good time to decide where.
5.CD to /user/<username>/github/
6.Type this stuff
> git config --global user.name "Your Name Here"
>git config --global user.email "your_email@example.com
(use the sign up information you used for your github account)
>git init (if you change where you want your github folder to be on your local machine,
make the change and then type this again from the new location to reset where Git sees your work.
7. Go back to your github account and from the repository you created copy the path under "HTTPS clone URL"
8. Type this stuff
> git clone <the HTTPS clone URL>
> <user.name>
> <user.pwd>
9. Look! You have a cloned Github repository on your local machine. Success! (Unless it didn't work.
Then I feel your pain.)
SPECIAL: Adding git creditial in windows machine: https://gitcredentialstore.codeplex.com/
------------------------------
Here's where you start to work!
------------------------------
Updating files with existing Repositiory from GitHub
I. Adding newly created file locally and add into existing repository.
to add a new file into my depo from locally use following commands
> git add filename ###add file name with extension without quote###
> git commit -a -m 'adding text'
> git push
II. Updating existing file that's been modified locally to existing repository.
> git commit -a -m 'type some text' ###add new text into ###
> git push
------------------------------------
Sync your master to Gh pages
http://brettterpstra.com/2012/09/26/github-tip-easily-sync-your-master-to-github-pages/
-----------------------------------------
Using CUGOS Revealz - presentation tool
-----------------------------------------
clone gh-pages instead of master
git clone Your Repo -b gh-pages (you'll be working with your copy of master and not master presentation itself).
!!IMPORTANT to use -b gh-pages!!
Note: To RUN on Windows Machine
Install Windows credential store for git
http://gitcredentialstore.codeplex.com/
--------------------------------
How the heck to I see that .html page in the browser via git?
-------------------------------
Add 'http://htmlpreview.github.io/?' in front of whatever you'd like to look at.
For example, 'http://htmlpreview.github.io/?https://github.com/defiantShaun/Leaflet_demo/blob/master/index.html'
Great tutorials... https://www.atlassian.com/git/tutorials/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment