#StandWithUkraine - Stop the Russian invasion

Bring together us and donate. All 2022 book royalties volition exist donated to:
Salve Life in Ukraine and Ukraine Humanitarian Appeal.

Create a New Repo and Upload Files on GitHub

Now that you lot've made a copy of our GitHub template, the side by side footstep is to learn how to create a make-new repo and upload files. These skills volition be helpful for several scenarios. Start, if yous have to fork a repo, which GitHub allows you to practise only one time, this method will let y'all to create additional copies. 2d, yous'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. In one case again, we'll demonstrate how to practice all of these steps in GitHub'south beginner-level browser interface, but run across the next section on GitHub Desktop for an intermediate-level interface that's more efficient for working with code templates.

In the previous department, yous created a copy of our GitHub repo with the Employ this template button, and we intentionally fix up our repos with this newer characteristic because information technology allows the user to brand multiple copies and assign each one a different name. Many other GitHub repos exercise not include a Template button, and then to re-create those you'll need to click the Fork push, which automatically generates a copy with the same repo name as the original. But what if you wish to fork someone's repo a second time? GitHub prevents y'all 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 piece of work.

And so how practice you brand a second fork of a GitHub repo, if there'south no Employ this template button? Follow our recommended workaround that's 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 lawmaking repo files to your make-new repo
  1. Click on the Lawmaking > Download Nothing drop-downward menu push button on any repo, as shown in Figure x.12. Your browser will download a zipped compressed binder with the contents of the repo to your local figurer, and it may ask you where you wish to salve it. Determine 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 figurer.

  1. Navigate to the location on your calculator where you saved the folder. Its file proper noun should end with .nil, which ways you demand to double-click to "unzip" or de-compress the folder. After y'all unzip it, a new folder will appear named in this format, REPOSITORY-BRANCH, which refers to the repository name (such as leaflet-map-simple) and the branch proper name (such every bit main), and information technology will contain the repo files. I of those files is named index.html, which you'll use in a few steps beneath.

  2. Go 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, equally shown in Effigy 10.13.

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

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

  1. On the next screen, GitHub will enquire you to enter a new repo name. Choose a curt one, preferably all lower-case, and separate words with hyphens if needed. Permit'south proper noun information technology practise considering we'll delete it at the finish of this tutorial.

Check the box to Initialize this repository with a README to simplify the adjacent steps.

Likewise, select Add together a license that matches the code you programme to upload, which in this case is MIT License. Other fields are optional. Click the green Create Repository push button at the bottom when washed, 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.

Figure 10.14: Proper name your new repo exercise, cheque the box to Initialize this repo with a README, and Add a license (select MIT) to friction match any code you plan to upload.

Your new repo volition take a spider web accost similar to https://github.com/USERNAME/practice.

  1. On your new repo home page, click the Add File > Upload Files drop-down carte du jour button, near the middle of the screen, every bit shown in Effigy x.15.

Click the Upload Files button.

Figure ten.xv: Click the Upload Files button.

  1. Within the repo binder that y'all previously downloaded and unzipped on your local estimator, drag-and-driblet the index.html file to the upload screen of your GitHub repo in your browser, as shown in Figure 10.sixteen. Do not upload LICENSE or README.physician because your new repo already contains those two files. Curlicue downwardly to click the green Commit Changes button.

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

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

When the upload is complete, your repo should incorporate three files, now including a re-create of the alphabetize.html code that y'all previously downloaded from the leaflet-map-simple template. This achieved our goal of working effectually GitHub's ane-fork rule, past creating a new repo and manually uploading a second copy of the code.

Optionally, y'all could employ 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 Copy, Edit, and Host a Simple Leaflet Map Template department of this chapter.

  1. Since this was simply a practise repo, let's delete it from GitHub. In the repo screen of your browser, click the height-right Settings push button, gyre all the manner downwards to the Danger Zone, and click Delete this repository, as shown in Figure ten.17. GitHub will enquire you to type in your username and repo name to ensure that you actually want to delete the repo, to testify 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: After clicking the Delete Repository button, GitHub will ask you to type your username and repo name to confirm.

And then far, yous've learned how to copy, edit, and host code using the GitHub web interface, which is a not bad introduction for beginners. Now you're ready to motion upward to tools that will permit you to work more efficiently with GitHub, such as GitHub Desktop and Atom Editor, to quickly move unabridged repos to your local computer, edit the code, and motion them back online.