Open a GitHub Shell and navigate to the directory that is storing your javascript files by using the CD command.
Now you will initialize the folder as a GitHub repository on your local machine. To do this type git init
and click Enter.
type in git remote add origin <your reposity name, such as https://github.com/boehnert/webpage.git>
. For example, I create a repository with name of choroplethlead
, then I just need to type git remote add origin https://github.com/xiaojianggis/choroplethlead.git
. This command will link your directory on your local machine with the GitHub repository. You will see this command on GitHub under how to push an existing repository from the command line.
Branch is just like a virtual environment. We can create a seperate environment and do experiment inside it. Now you need to create a branch called gh-pages
from GitHub and switch to this branch. Type in git checkout -b gh-pages
. This command with switch to the gh-pages branch in the repository.
Now just commit everything in the folder to your repository by typing in git add .
, then type in git commit -m 'This is my initial commit'
Push your project up to the branch gh-pages by typing in git push origin gh-pages
Now your project is up on GitHub. In a web browser log into your GitHub account and view the project in the gh-pages branch. You can also view the web site using your http://.github.io/repository name. My final website can be viewed at https://xiaojianggis.github.io/choroplethlead/
echo "# choropleth-lead" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/xiaojianggis/choropleth-lead.git git push -u origin master