How to Upload to a Github Repository
#StandWithUkraine - Stop the Russian invasion
Join the states and donate. All 2022 book royalties volition be donated to:
Save Life in Ukraine and Ukraine Humanitarian Appeal.
Create a New Repo and Upload Files on GitHub
At present that you lot've made a re-create of our GitHub template, the next step is to larn how to create a make-new repo and upload files. These skills will exist helpful for several scenarios. Start, if you have to fork a repo, which GitHub allows you to practise simply once, this method volition permit you to create boosted copies. Second, you'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 once more, we'll demonstrate how to do all of these steps in GitHub'southward beginner-level browser interface, only come across the next section on GitHub Desktop for an intermediate-level interface that'south more efficient for working with lawmaking templates.
In the previous department, you created a copy of our GitHub repo with the Apply this template button, and we intentionally prepare our repos with this newer characteristic because it allows the user to make multiple copies and assign each one a unlike name. Many other GitHub repos do not include a Template button, and so to copy those you'll need to click the Fork push button, which automatically generates a copy with the aforementioned repo name as the original. But what if you lot wish to fork someone's repo a second time? GitHub prevents yous from creating a second fork to avoid violating one of its important rules: every repo in your account must have a unique name, to avoid overwriting and erasing your piece of work.
Then how do you make a second fork of a GitHub repo, if there's no Use this template button? Follow our recommended workaround that's summarized in these three steps:
- Download the existing GitHub repo to your local reckoner
- Create a brand-new GitHub repo with a new name
- Upload the existing lawmaking repo files to your brand-new repo
- Click on the Code > Download Zip drib-downwardly menu button on whatsoever 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 it may ask you lot where y'all wish to relieve it. Make up one's mind on a location and click OK.
Effigy 10.12: Click Code and select Download Zip to create a compressed folder of a repo on your figurer.
-
Navigate to the location on your computer where you lot saved the folder. Its file name should end with
.zip, which ways you need to double-click to "unzip" or de-compress the binder. After you unzip information technology, a new folder will appear named in this format,REPOSITORY-Branch, which refers to the repository name (such asleaflet-map-elementary) and the branch proper name (such asprincipal), and it will contain the repo files. I of those files is namedindex.html, which you'll use in a few steps beneath. -
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, every bit shown in Figure 10.13.
Effigy 10.13: Click the plus (+) symbol in upper-correct corner to create a new repo.
- On the next screen, GitHub volition enquire y'all to enter a new repo proper name. Cull a short one, preferably all lower-case, and separate words with hyphens if needed. Let's proper name it
practicebecause we'll delete information technology at the end of this tutorial.
Check the box to Initialize this repository with a README to simplify the side by side steps.
Also, select Add a license that matches the code yous plan to upload, which in this instance is MIT License. Other fields are optional. Click the greenish Create Repository button at the bottom when done, as shown in Figure 10.14.
Figure x.xiv: Name your new repo do, bank check the box to Initialize this repo with a README, and Add a license (select MIT) to match any code yous plan to upload.
Your new repo will have a web accost similar to https://github.com/USERNAME/practice.
- On your new repo home folio, click the Add File > Upload Files drop-downward menu push button, nigh the eye of the screen, as shown in Effigy 10.fifteen.
Figure 10.15: Click the Upload Files button.
- Inside the repo folder that y'all previously downloaded and unzipped on your local figurer, drag-and-driblet the
alphabetize.htmlfile to the upload screen of your GitHub repo in your browser, every bit shown in Figure 10.16. Do not uploadLICENSEorREADME.mdbecause your new repo already contains those two files. Scroll down to click the green Commit Changes button.
Figure ten.16: Drag-and-drop the index.html file to the upload screen.
When the upload is complete, your repo should comprise three files, now including a copy of the alphabetize.html code that you previously downloaded from the leaflet-map-simple template. This achieved our goal of working effectually GitHub's one-fork dominion, by creating a new repo and manually uploading a second re-create of the lawmaking.
Optionally, you could use GitHub Pages to publish a alive version of the code online, and paste the links to the alive version at the top of your repo and your README.medico file, equally described in the Copy, Edit, and Host a Simple Leaflet Map Template section of this chapter.
- Since this was merely a
dorepo, let's delete information technology from GitHub. In the repo screen of your browser, click the top-right Settings button, scroll all the fashion down to the Danger Zone, and click Delete this repository, as shown in Figure 10.17. GitHub will ask you to type in your username and repo proper noun to ensure that you really want to delete the repo, to prove you are not a drunken credibility chef.
Effigy ten.17: Afterwards clicking the Delete Repository push, GitHub volition ask you lot to type your username and repo name to ostend.
So far, yous've learned how to re-create, edit, and host lawmaking using the GitHub spider web interface, which is a groovy introduction for beginners. At present you're ready to move up to tools that will permit y'all to work more than efficiently with GitHub, such as GitHub Desktop and Atom Editor, to quickly motion entire repos to your local estimator, edit the code, and move them back online.
Source: https://handsondataviz.org/create-repo.html
0 Response to "How to Upload to a Github Repository"
ارسال یک نظر