Skip to content

Instantly share code, notes, and snippets.

@defiantShaun
Forked from keum/Basic Git usage
Last active December 24, 2015 12:49
Show Gist options
  • Save defiantShaun/6800048 to your computer and use it in GitHub Desktop.
Save defiantShaun/6800048 to your computer and use it in GitHub Desktop.
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 git <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.)
------------------------------
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
-------------------------------
Grab some stuff from github down to your machine to work on
--------------------------------
> git clone https://github.com/defiantShaun/"reponame" -b (master|gh-pages)
--------------------------------
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/
---------------------------------
If you want to start with a repo on your machine and push it up to github for the first time
----------------------------------
https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment