#StandWithUkraine - Stop the Russian invasion

Join usa and donate. All 2022 book royalties will exist donated to:
Save Life in Ukraine and Ukraine Humanitarian Entreatment.

Create a New Repo and Upload Files on GitHub

At present that you've made a re-create of our GitHub template, the side by side pace is to larn how to create a make-new repo and upload files. These skills volition be helpful for several scenarios. First, if you have to fork a repo, which GitHub allows you to do only one fourth dimension, this method volition allow you to create additional copies. Second, you lot'll need to upload some of your own files when creating data visualizations using Chart.js and Highcharts templates in Chapter 11 and Leaflet map templates in Chapter 12. Once again, we'll demonstrate how to do all of these steps in GitHub'due south beginner-level browser interface, but see the next department on GitHub Desktop for an intermediate-level interface that'south more efficient for working with code templates.

In the previous section, yous created a copy of our GitHub repo with the Use this template button, and we intentionally gear up our repos with this newer feature because information technology allows the user to brand multiple copies and assign each one a different name. Many other GitHub repos exercise non include a Template button, so to re-create those you'll need to click the Fork push button, which automatically generates a copy with the same repo name every bit the original. But what if you wish to fork someone'due south repo a second time? GitHub prevents you from creating a second fork to avert violating ane of its of import rules: every repo in your account must have a unique proper name, to avoid overwriting and erasing your work.

And then how practise you brand a second fork of a GitHub repo, if in that location's no Use this template button? Follow our recommended workaround that's summarized in these iii steps:

  • Download the existing GitHub repo to your local computer
  • Create a make-new GitHub repo with a new name
  • Upload the existing lawmaking repo files to your brand-new repo
  1. Click on the Code > Download Naught driblet-down menu push button on any repo, as shown in Figure 10.12. Your browser will download a zipped compressed folder with the contents of the repo to your local computer, and information technology may ask you where you wish to relieve it. Decide on a location and click OK.

Click Code and select Download Zip to create a compressed folder of a repo on your computer.

Figure 10.12: Click Code and select Download Zilch to create a compressed folder of a repo on your computer.

  1. Navigate to the location on your computer where you saved the folder. Its file proper name should terminate with .naught, which means y'all need to double-click to "unzip" or de-compress the folder. After you unzip it, a new folder will appear named in this format, REPOSITORY-Branch, which refers to the repository proper name (such as leaflet-map-elementary) and the branch proper noun (such as primary), and it will contain the repo files. 1 of those files is named alphabetize.html, which you'll use in a few steps below.

  2. Get back to your GitHub business relationship in your web browser, click on the plus (+) symbol in the upper-right corner of your account, and select New repository, as shown in Effigy 10.13.

Click the plus (+) symbol in upper-right corner to create a new repo.

Effigy 10.13: Click the plus (+) symbol in upper-right corner to create a new repo.

  1. On the next screen, GitHub will ask you to enter a new repo name. Cull a short one, preferably all lower-instance, and divide words with hyphens if needed. Permit's proper name information technology practise because we'll delete it at the end of this tutorial.

Bank check the box to Initialize this repository with a README to simplify the next steps.

Too, select Add a license that matches the code you programme to upload, which in this case is MIT License. Other fields are optional. Click the light-green Create Repository push button at the bottom when done, equally shown in Figure 10.14.

Name your new repo practice, check the box to Initialize this repo with a README, and Add a license (select MIT) to match any code you plan to upload.

Effigy 10.14: Name your new repo practice, check the box to Initialize this repo with a README, and Add together a license (select MIT) to lucifer any code you plan to upload.

Your new repo will have a web address similar to https://github.com/USERNAME/exercise.

  1. On your new repo home page, click the Add together File > Upload Files drop-down carte du jour push, near the middle of the screen, equally shown in Effigy 10.15.

Click the Upload Files button.

Figure 10.15: Click the Upload Files push.

  1. Inside the repo folder that yous previously downloaded and unzipped on your local computer, drag-and-driblet the index.html file to the upload screen of your GitHub repo in your browser, as shown in Figure x.16. Practice non upload LICENSE or README.md because your new repo already contains those two files. Ringlet down to click the green Commit Changes push button.

Drag-and-drop the index.html file to the upload screen.

Figure x.16: Elevate-and-drop the alphabetize.html file to the upload screen.

When the upload is complete, your repo should comprise three files, at present including a copy of the index.html code that you previously downloaded from the leaflet-map-simple template. This achieved our goal of working around GitHub'southward one-fork rule, by creating a new repo and manually uploading a second copy of the lawmaking.

Optionally, you could utilize GitHub Pages to publish a live version of the lawmaking online, and paste the links to the live version at the top of your repo and your README.md file, as described in the Re-create, Edit, and Host a Elementary Leaflet Map Template section of this chapter.

  1. Since this was only a do repo, let's delete information technology from GitHub. In the repo screen of your browser, click the top-right Settings button, whorl all the way down to the Danger Zone, and click Delete this repository, equally shown in Effigy 10.17. GitHub volition ask you to type in your username and repo name to ensure that you lot really want to delete the repo, to evidence you are not a drunken brownie chef.

After clicking the Delete Repository button, GitHub will ask you to type your username and repo name to confirm.

Figure 10.17: Afterward clicking the Delete Repository button, GitHub will ask you lot to type your username and repo name to ostend.

And then far, you've learned how to copy, edit, and host code using the GitHub web interface, which is a great introduction for beginners. Now you're ready to movement up to tools that will let you lot to piece of work more efficiently with GitHub, such as GitHub Desktop and Atom Editor, to quickly move unabridged repos to your local reckoner, edit the code, and move them dorsum online.