#StandWithUkraine - Stop the Russian invasion

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

Create a New Repo and Upload Files on GitHub

Now that you've made a re-create of our GitHub template, the next step is to learn how to create a brand-new repo and upload files. These skills will be helpful for several scenarios. Kickoff, if you have to fork a repo, which GitHub allows yous to exercise only one time, this method will allow yous to create additional copies. Second, you lot'll demand 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. One time again, we'll demonstrate how to do all of these steps in GitHub'due south beginner-level browser interface, merely come across the next department on GitHub Desktop for an intermediate-level interface that's more efficient for working with code templates.

In the previous section, yous created a copy of our GitHub repo with the Utilize this template button, and nosotros intentionally prepare our repos with this newer feature because it allows the user to brand multiple copies and assign each i a different name. Many other GitHub repos practice not include a Template button, so to copy those you lot'll need to click the Fork push, which automatically generates a copy with the aforementioned repo proper name equally the original. But what if yous wish to fork someone'south repo a 2nd time? GitHub prevents you from creating a second fork to avoid violating one of its important rules: every repo in your business relationship must have a unique name, to avoid overwriting and erasing your work.

So how practise you lot brand a second fork of a GitHub repo, if there's no Use this template push? Follow our recommended workaround that'due south summarized in these three steps:

  • Download the existing GitHub repo to your local computer
  • Create a brand-new GitHub repo with a new name
  • Upload the existing code repo files to your brand-new repo
  1. Click on the Code > Download Zip drop-down menu button on any repo, as shown in Effigy x.12. Your browser will download a zipped compressed folder with the contents of the repo to your local computer, and it may inquire yous where you wish to save 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.

Effigy 10.12: Click Code and select Download Zip to create a compressed folder of a repo on your calculator.

  1. Navigate to the location on your reckoner where you saved the folder. Its file proper name should finish with .zip, which means you need to double-click to "unzip" or de-shrink the folder. Later you unzip information technology, a new folder will appear named in this format, REPOSITORY-BRANCH, which refers to the repository name (such as leaflet-map-simple) and the co-operative name (such every bit main), and it will contain the repo files. One of those files is named alphabetize.html, which you'll use in a few steps below.

  2. Go back to your GitHub account in your web browser, click on the plus (+) symbol in the upper-right corner of your account, and select New repository, as shown in Figure 10.thirteen.

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

Figure 10.xiii: Click the plus (+) symbol in upper-correct corner to create a new repo.

  1. On the next screen, GitHub will inquire yous to enter a new repo name. Choose a short one, preferably all lower-case, and separate words with hyphens if needed. Let'southward proper name it practise because we'll delete information technology at the stop of this tutorial.

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

Likewise, select Add a license that matches the lawmaking yous plan to upload, which in this case is MIT License. Other fields are optional. Click the green Create Repository button at the bottom when done, as shown in Figure x.xiv.

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 x.14: Proper noun your new repo practice, cheque the box to Initialize this repo with a README, and Add a license (select MIT) to match any code you plan to upload.

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

  1. On your new repo habitation page, click the Add together File > Upload Files drop-downwardly menu push, nigh the middle of the screen, equally shown in Figure ten.15.

Click the Upload Files button.

Figure 10.15: Click the Upload Files button.

  1. Within the repo folder that you previously downloaded and unzipped on your local calculator, drag-and-drop the index.html file to the upload screen of your GitHub repo in your browser, as shown in Figure 10.xvi. Practise non upload LICENSE or README.doc because your new repo already contains those two files. Curlicue down to click the green Commit Changes button.

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

Figure x.16: Drag-and-driblet the index.html file to the upload screen.

When the upload is consummate, your repo should contain iii files, now including a copy of the index.html code that you previously downloaded from the leaflet-map-simple template. This achieved our goal of working effectually GitHub's 1-fork dominion, by creating a new repo and manually uploading a second copy of the code.

Optionally, you could use GitHub Pages to publish a live version of the code online, and paste the links to the alive version at the meridian of your repo and your README.md file, equally described in the Copy, Edit, and Host a Simple Leaflet Map Template department of this chapter.

  1. Since this was only a practice repo, let'due south delete it from GitHub. In the repo screen of your browser, click the tiptop-right Settings push button, scroll all the fashion downward to the Danger Zone, and click Delete this repository, as shown in Figure x.17. GitHub will ask yous to type in your username and repo name to ensure that you really want to delete the repo, to evidence you lot 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 yous to type your username and repo proper name to confirm.

So far, you've learned how to copy, edit, and host code using the GitHub web interface, which is a smashing introduction for beginners. Now yous're ready to motion up to tools that will allow you to piece of work more than efficiently with GitHub, such equally GitHub Desktop and Atom Editor, to speedily move unabridged repos to your local computer, edit the code, and move them back online.