Last active
November 7, 2015 05:33
-
-
Save keum/d594878f7cfc6b8f0c7c to your computer and use it in GitHub Desktop.
How to: Adding Existing Project into GitHub Page using CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary from this site: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ | |
Easy definition | |
Local Repository = your laptop folder | |
Remote Repository = your GitHub account website | |
Origin = your local directory in your laptop | |
Master = your copy existing in GitHub site. | |
Step 1: | |
Create new repository in GitHub web site. | |
Do not initialize with README.md | |
Step 2: | |
Go to terminal window and change directory to where your project exist | |
Step 3: | |
In Terminal windows | |
>git init //this is to initalize git | |
>git add . //this is to select all files under that folder | |
>git commit -m "first commit" // adding comment to your commit | |
>git remote add origin 'remote repository URL' //url from GitHub repository | |
after you've created new repo at Step 1. | |
>git remote -v //verifying the URL master | |
>git push origin master //pushing your files in selected directory into GitHub | |
repository you created in step 1. | |
>git status //to see the change | |
====================== | |
IF you want to clone just gh-page locally from repo, do this under local previoulsy installed master directory | |
>git chekout gh-pages | |
this will download gh-pages under the same name as the master directory. | |
================ | |
----------------------------------------- | |
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 | |
>git -b gh-pages https://github.com/your repo.git | |
Note: To RUN on Windows Machine | |
Install Windows credential store for git | |
http://gitcredentialstore.codeplex.com/ | |
============= Syncing gh-pages with master =================== | |
to a tip from denbuzze on Stack Overflow I found a way to keep gh-pages in sync with master that’s so simple you’ll forget it’s even happening. | |
In your local clone of your GitHub repository, add these two lines to .git/config, in the [remote “origin”] section: | |
push = +refs/heads/master:refs/heads/gh-pages | |
push = +refs/heads/master:refs/heads/master | |
The section should now look something like this: | |
[remote "origin"] | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
url = [email protected]:user/repo.git | |
push = +refs/heads/master:refs/heads/gh-pages | |
push = +refs/heads/master:refs/heads/master | |
Now, when you push to GitHub (git push), your gh-pages branch is mirrored and everything in your repository is viewable at http://user.github.com/repository/. That’s pretty sweet. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment