Publishing via GitHub

Source: Internet
Author: User
Tags web hosting version control system

Now let's take your through how to publish your site via GitHub pages. We aren ' t saying this was the only-or even best-to-publish your site, but it's free, fairly-simple, and touches up On some new skills so you ll find useful going forward.

Basic Setup
    1. First of all, install Git on your. This is the underlying version control system software, GitHub works on top.
    2. Next, sign up for a GitHub account. It ' s simple and easy.
    3. Once you ' ve signed up, log on to github.com with your username and password.
    4. Next, you need to create a new repo for your files to go. Click Plus (+) in the top right of the GitHub homepage, then choose New Repository.
    5. On this page, in the Repository name box, enter username. Github.io, where usernameis your usern Ame. So for example, our friend Bobsmith would enterBobsmith.github.io.
    6. Click Create repository; This should bring the following page:
Uploading your files to GitHub

This is where we'll have a go in using the command line to put our repository on GitHub. A command line was a window where you type in commands to does things like create files and run programs, rather than ClickIn G inside a user interface. It'll look something like this:

Note: You could also consider using a Git graphical user interface to does the same work if you feel uncomfortable With the command line.

Every operating system comes with a command line tool:

    • Windows: command Prompt can accessed by pressing the Windows key, typingcommand Prompt, and Choosing it from the list that appears. Note that Windows have its own command conventions differing from Linux and OS X, so the commands below could vary on your MA Chine.
    • OS X: Terminal can found in applications > Utilities.
    • Linux: Usually you can pull up a terminal with Ctrl + Alt + T. If that doesn ' t work, the look for Terminal in an app bar or menu.

This could seem a bit scary at first, but don ' t worry-you ' ll soon get the hang of the basics. You tell the computer to does something in the terminal by typing in a command and hitting Enter.

  1. Point the command line to your test-site directory (or whatever you called the directory containing your website). For this, use the cd command (i.e. "ChangeDirectory"). Here's what's your ' d type if you've put your website in a directory called on test-site your desktop:
    CD Desktop/test-site

      

  2. When the command line is pointing inside your website directory, type the following command, which tells the git tool Tu RN the directory into a git repository:
    Git init

      

  3. Next, go to the GitHub site. On the current page, your is interested in the section ... or push an existing repositoryfrom the command line. You should see the lines of code listed in this section. Copy the whole of the first line, paste it to the command line, and press Enter. The command should look something like this:
    Git remote add Origin https://github.com/bobsmith/bobsmith.github.io.git

      

  4. Next, type the following, commands, pressing Enter after each one. These prepare the code for uploading to GitHub, and ask Git to manage these files.
    git add--allgit commit-m ' adding my files to my repository '

      

  5. Finally, push the code up to GitHub by going to the GitHub Web page you ' re on and entering into the terminal the second of The commands we saw in step 3:
    Git push-u Origin Master

      

  6. Now if you go to your GitHub pages ' web address in a new browser tab (Username.github.io), you should see your Site online! Email it to your friends and show off your mastery.

Note: If you get stuck, the GitHub Pages homepage is also really helpful.

Further GitHub knowledge

If you want to do more changes to your test site and upload those to GitHub, you simply need to make the change to your Files just like your did before. Then, you need to enter the following commands (pressing ENTER after each one) to push those changes to GitHub:

git add--allgit commit-m ' another commit ' git push

  

You can replace the another commit with a more suitable message to describe what the change you just made.

We have barely scratched the surface of Git. To learn more, start off with the GitHub help site.

Conclusion

By this point, you should has your sample website available at a unique web address. Well done!

Further reading
    • What is a Web server
    • Understanding domain Names
    • How much does does something on the web?
    • Cheap or free static web hosting by Scott Murray have some useful ideas on available services.

Publishing via GitHub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.