Do You Upload .git File to Website
How practice I utilize GitHub Pages?
GitHub is a "social coding" site. Information technology allows yous to upload code repositories for storage in the Git version control organization. You tin so collaborate on code projects, and the system is open-source by default, meaning that anyone in the globe can notice your GitHub code, utilize information technology, larn from it, and amend on it. Y'all tin do that with other people's code 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 get involved in, and Git/GitHub is a very popular version control arrangement — virtually tech companies now use it in their workflow. GitHub has a very useful feature called GitHub Pages, which allows you lot to publish website code live on the Web.
Bones GitHub setup
- Start of all, install Git on your machine. This is the underlying version control organisation software that GitHub works on top of.
- Next, sign upward 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
You can store any code y'all like in a GitHub repository, but to utilise the GitHub Pages characteristic to full effect, your code should be structured as a typical website, e.k. with the primary entry point being an HTML file chosen index.html
.
The other thing you need to practise earlier moving on is to initialise your lawmaking directory as a Git repository. To do this:
- Point the command line to your
test-site
directory (or whatever you lot called the directory containing your website). For this, use thecd
command (i.e. "change directory"). Here'southward what you'd type if y'all've put your website in a directory chosentest-site
on your desktop: - When the command line is pointing inside your website directory, blazon the following control, which tells the
git
tool to turn the directory into a git repository:
An aside on command line interfaces
The all-time mode to upload your code to GitHub is via the command line — this is a window where y'all type in commands to practice things similar create files and run programs, rather than clicking inside a user interface. It will look something similar this:
Annotation: You could also consider using a Git graphical user interface to practise the same work, if you feel uncomfortable with the command line.
Every operating system comes with a command line tool:
- Windows: Command Prompt can be accessed by pressing the Windows central, typing Command Prompt, and choosing it from the list that appears. Note that Windows has its own control conventions differing from Linux and Os X, so the commands below may vary on your machine.
- Bone Ten: Concluding can be establish in Applications > Utilities.
- Linux: Usually you lot can 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, simply don't worry — you lot'll presently get the hang of the basics. Y'all tell the estimator to practise something in the concluding by typing in a command and hitting Enter, as seen above.
Creating a repo for your code
Uploading your files to GitHub
- On the electric current folio, y'all are interested in the department …or push button an existing repository from the control line. You lot 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 press Enter. The command should expect something like this:
git remote add origin https://github.com/chrisdavidmills/my-repository.git
- Adjacent, blazon the following two commands, pressing Enter later each 1. These prepare the code for uploading to GitHub, and ask Git to manage these files.
git add --all git commit -m 'adding my files to my repository'
- Finally, button the code up to GitHub by going to the GitHub spider web page yous'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:
- At present you lot need to turn GitHub pages on for your repository. To do this, from the homepage of your repository choose Settings, then select Pages from the sidebar on the left. Underneath Source, choose the "principal" branch. The folio should refresh.
- Go to the GitHub Pages section again, and yous should see a line of the course "Your site is set up to be published at https://xxxxxx."
- If you click on this URL, you lot should go to a alive version of your example, provided the home folio is called
index.html
— it goes to this entry point past default. If your site'due south entry point is called something else, for examplemyPage.html
, you'll demand to get tohttps://xxxxxx/myPage.html
.
Further GitHub knowledge
If you desire to make more changes to your test site and upload those to GitHub, yous need to make the change to your files just like you did before. Then, you lot need to enter the following commands (pressing Enter after each one) to push button those changes to GitHub:
git add --all git commit -grand 'some other commit' git button
You can replace some other commit with a more suitable message to describe what change you merely made.
Nosotros have barely scratched the surface of Git. To learn more than, check out our Git and GitHub folio.
Source: https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Using_Github_pages
0 Response to "Do You Upload .git File to Website"
Postar um comentário