What Should I Upload To Github
How do I use GitHub Pages?
GitHub is a "social coding" site. It allows yous to upload code repositories for storage in the Git version command organization. You can and then collaborate on code projects, and the organization is open-source past default, meaning that anyone in the world can discover your GitHub code, use information technology, larn from it, and ameliorate on it. You can do that with other people'south lawmaking too! This article provides a basic guide to publishing content using Github's gh-pages feature.
Publishing content
GitHub is a very important and useful community to become involved in, and Git/GitHub is a very popular version control system — most tech companies now apply it in their workflow. GitHub has a very useful feature chosen GitHub Pages, which allows you to publish website lawmaking live on the Web.
Bones Github setup
- Commencement of all, install Git on your auto. This is the underlying version control system software that GitHub works on top of.
- Next, sign up for a GitHub account. It's elementary and easy.
- Once you've signed up, log in to github.com with your username and password.
Preparing your code for upload
Y'all can store any code yous like in a Github repository, but to utilise the GitHub Pages feature to full outcome, your code should be structured as a typical website, e.g. with the primary entry signal beingness an HTML file called alphabetize.html
.
The other affair you demand to exercise before moving on is to initialise your lawmaking directory every bit a Git repository. To exercise this:
- Point the command line to your
test-site
directory (or any you called the directory containing your website). For this, utilise thecd
command (i.e. "change directory"). Here's what you'd blazon if yous've put your website in a directory calledexam-site
on your desktop: - When the control line is pointing inside your website directory, blazon the post-obit control, which tells the
git
tool to turn the directory into a git repository:
An aside on command line interfaces
The best way to upload your code to Github is via the command line — this is a window where you type in commands to do things like create files and run programs, rather than clicking inside a user interface. It volition wait something like this:
Note: You could also consider using a Git graphical user interface to do the same work, if you feel uncomfortable with the command line.
Every operating system comes with a control line tool:
- Windows: Control Prompt tin be accessed by pressing the Windows central, typing Control Prompt, and choosing information technology from the listing that appears. Notation that Windows has its ain command conventions differing from Linux and Bone 10, so the commands below may vary on your machine.
- OS X: Terminal tin be found in Applications > Utilities.
- Linux: Usually you tin can pull up a terminal with Ctrl + Alt + T. If that doesn't work, look for Concluding in an app bar or menu.
This may seem a bit scary at showtime, but don't worry — you lot'll soon get the hang of the basics. You lot tell the computer to practice something in the final by typing in a command and striking Enter, as seen in a higher place.
Creating a repo for your lawmaking
Uploading your files to GitHub
- On the current page, you are interested in the section …or push an existing repository from the command line. You should see two lines of code listed in this section. Re-create the whole of the first line, paste it into the command line, and printing Enter. The command should expect something similar this:
git remote add origin https://github.com/chrisdavidmills/my-repository.git
- Next, type the following two commands, pressing Enter afterwards each one. These set the lawmaking for uploading to GitHub, and ask Git to manage these files.
git add --all git commit -k 'calculation my files to my repository'
- Finally, button the lawmaking upwards to GitHub by going to the GitHub web folio you're on and entering into the terminal the second of the ii commands we saw the …or push an existing repository from the command line section:
- Now you need to plow GitHub pages on for your repository. To practise this, from the homepage of your repository cull Settings, and so select Pages from the sidebar on the left. Underneath Source, choose the "chief" branch. The page should refresh.
- Go to the GitHub Pages department again, and you should see a line of the form "Your site is set up to exist published at https://xxxxxx."
- If you click on this URL, y'all should become to a live version of your example, provided the home page is called
index.html
— it goes to this entry bespeak by default. If your site's entry indicate is called something else, for casemyPage.html
, you'll need to become tohttps://xxxxxx/myPage.html
.
Further GitHub noesis
If you want to make more changes to your test site and upload those to GitHub, you demand to make the change to your files only like yous did earlier. Then, you need to enter the following commands (pressing Enter afterwards each one) to push those changes to GitHub:
git add --all git commit -thousand 'another commit' git push button
You lot can replace another commit with a more suitable message to describe what modify y'all just made.
We have barely scratched the surface of Git. To learn more than, check out our Git and GitHub page.
Source: https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Using_Github_pages
Posted by: baronmoreary.blogspot.com
0 Response to "What Should I Upload To Github"
Post a Comment