So you want to launch a simple website but dont want to have to go through the dull process of setting up yet another hosting package.Or you dont have money to buy a hosting package as they are often expensive and limited if you dont have enough money. There is an easier solution. If you just want to launch a simple static website you can use GitHub Pages to host your site for free.
Lets get started.
GUIDE CONTENTS:
Needed:
Step 1:
All webpages containt some basic stuff.Your webpage contains for example:
So all this needs to be uploaded somewhere.You ask me where ?Well we are gonna host on github ,right? Then lets upload it there.
Go to your github account.And go to the repositories tab.Then click new.And name your repository whatever you want.


Step 1 is complete.Congratulations lets move on.
Step 2 is all about a little terminal play.
Step 2:
Now open up terminal (command prompt on Windows) and make sure that you have a copy of your GitHub repo on your computer. Once you got your local copy, move into the project folder using the cd command.
How are you going to that you can see in the following example.
Creating an Orphan Branch
Now you need to create a new orphan branch within your repo that will hold all of your website files.
This new branch should be called gh-pages.
If you already had files in the master branch of your GitHub repo you now need to delete these from the new gh-pages branch. To do this you can use the following command:
Adding Your Website Files
Now that your repo has been properly setup its time to add all of the HTML, CSS and JavaScript files that make up your website. Once you have added these to your repo you need to commit the changes. To do this you can use the following command.
Note: The -a flag is shorthand for git add .
Congratulations step 2 is now complete.
Step 3:
Pushing Your Changes to GitHub
Okay so youve got all your files where they need to be. The only thing left to do now is to push the new gh-pages branch up to GitHub. You do this using the git push command.
Thats it! Your website should now be available at http://username.github.io/repository/.
Lets get started.
GUIDE CONTENTS:
HTML Code:
***How to start.(Requirments,How to make a repository,
How to make a proper branch,
How to prepare your web,
How to upload.
***Using a custom domain.
***Some final thoughts
***Help users(help each other....))
PHP Code:
***A github account
***Some basic git knowladge
***A domain
***Knowladge about forwarding
Thats it.
Step 1:
All webpages containt some basic stuff.Your webpage contains for example:
PHP Code:
***index.html (your main page)
***example.html (some other page)
***assets (a folder containing your assets)
***css (cascading style sheet){your website style}
***img(web images duh)
***js(some simple or not that simple javascript files)
Go to your github account.And go to the repositories tab.Then click new.And name your repository whatever you want.


Step 1 is complete.Congratulations lets move on.
Step 2 is all about a little terminal play.
Step 2:
Now open up terminal (command prompt on Windows) and make sure that you have a copy of your GitHub repo on your computer. Once you got your local copy, move into the project folder using the cd command.
How are you going to that you can see in the following example.
PHP Code:
// Retrieve a copy of your GitHub repo.
git clone https://github.com/user/repository.git
// Move into that directory.
cd repository
Creating an Orphan Branch
Now you need to create a new orphan branch within your repo that will hold all of your website files.
This new branch should be called gh-pages.
PHP Code:
git checkout --orphan gh-pages
PHP Code:
git rm -rf .
Now that your repo has been properly setup its time to add all of the HTML, CSS and JavaScript files that make up your website. Once you have added these to your repo you need to commit the changes. To do this you can use the following command.
PHP Code:
git commit -a -m "Adding pages"
Congratulations step 2 is now complete.
Step 3:
Pushing Your Changes to GitHub
Okay so youve got all your files where they need to be. The only thing left to do now is to push the new gh-pages branch up to GitHub. You do this using the git push command.
PHP Code:
git push origin gh-pages
Aucun commentaire:
Enregistrer un commentaire