How to Upload Site to Github With Terminal

How do I use GitHub Pages?

GitHub is a "social coding" site. It allows you to upload code repositories for storage in the Git version control system. You can then collaborate on code projects, and the organization is open-source by default, significant that anyone in the globe tin notice your GitHub lawmaking, use it, learn from it, and meliorate on it. You tin can practise that with other people'due south code likewise! This article provides a basic guide to publishing content using GitHub'due south gh-pages feature.

Publishing content

GitHub is a very of import and useful customs to become involved in, and Git/GitHub is a very pop version command system — well-nigh tech companies now use it in their workflow. GitHub has a very useful feature called GitHub Pages, which allows you to publish website code live on the Web.

Bones GitHub setup

  1. First of all, install Git on your automobile. This is the underlying version control system software that GitHub works on top of.
  2. Next, sign up for a GitHub account. It'south simple and easy.
  3. Once y'all've signed up, log in to github.com with your username and password.

Preparing your code for upload

Y'all can store any lawmaking y'all like in a GitHub repository, but to apply the GitHub Pages feature to full effect, your code should be structured as a typical website, due east.one thousand. with the primary entry point being an HTML file called alphabetize.html.

The other matter you need to do before moving on is to initialise your code directory as a Git repository. To practise this:

  1. Signal the control line to your test-site directory (or whatever you called the directory containing your website). For this, use the cd command (i.east. "change directory"). Here's what you'd blazon if you've put your website in a directory chosen test-site on your desktop:
  2. When the command line is pointing inside your website directory, type the post-obit command, which tells the git tool to turn the directory into a git repository:

An aside on command line interfaces

The best style to upload your code to GitHub is via the command line — this is a window where you type in commands to do things similar create files and run programs, rather than clicking inside a user interface. It volition look something like this:

Notation: You lot could also consider using a Git graphical user interface to practice the same piece of work, if yous feel uncomfortable with the control line.

Every operating organisation comes with a control line tool:

  • Windows: Control Prompt can be accessed by pressing the Windows fundamental, typing Command Prompt, and choosing information technology from the listing that appears. Annotation that Windows has its own control conventions differing from Linux and Bone Ten, and so the commands beneath may vary on your machine.
  • Bone X: Concluding can be found in Applications > Utilities.
  • Linux: Normally you tin pull up a final with Ctrl + Alt + T. If that doesn't work, look for Terminal in an app bar or menu.

This may seem a bit scary at first, but don't worry — yous'll soon get the hang of the basics. Y'all tell the computer to do something in the terminal by typing in a command and hit Enter, as seen higher up.

Creating a repo for your code

Uploading your files to GitHub

  1. On the electric current folio, y'all are interested in the section …or push an existing repository from the control line. You should encounter 2 lines of lawmaking listed in this section. Copy the whole of the get-go line, paste it into the command line, and press Enter. The control should look something like this:
                                              git                      remote                      add                      origin https://github.com/chrisdavidmills/my-repository.git                                      
  2. Next, type the following ii commands, pressing Enter after each one. These prepare the code for uploading to GitHub, and ask Git to manage these files.
                                              git                      add                      --all                      git                      commit -thou                      'adding my files to my repository'                                      
  3. Finally, push the code up to GitHub by going to the GitHub web page you're on and inbound into the concluding the second of the two commands nosotros saw the …or push an existing repository from the command line section:
  4. Now you lot need to turn GitHub pages on for your repository. To exercise this, from the homepage of your repository cull Settings, so select Pages from the sidebar on the left. Underneath Source, choose the "main" co-operative. The page should refresh.
  5. Become to the GitHub Pages section again, and you should run across a line of the form "Your site is prepare to be published at https://xxxxxx."
  6. If you click on this URL, y'all should go to a live version of your case, provided the home page is chosen alphabetize.html — it goes to this entry signal by default. If your site's entry betoken is called something else, for example myPage.html, you lot'll need to become to https://xxxxxx/myPage.html.

Further GitHub knowledge

If you want to make more changes to your test site and upload those to GitHub, you need to make the change to your files just like you did before. Then, you need to enter the post-obit commands (pressing Enter later each one) to button those changes to GitHub:

git add --all git commit -m 'some other commit' git button            

You tin can supersede another commit with a more suitable bulletin to draw what modify you just fabricated.

We have barely scratched the surface of Git. To learn more, bank check out our Git and GitHub page.

robertsaboth1952.blogspot.com

Source: https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Using_Github_pages

0 Response to "How to Upload Site to Github With Terminal"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel