How Do I Upload My Files to Github Fork
In that location are a bunch of GitHub (and other git host) repositories that aren't actually for software projects, but rather are for documentation or other resources. For example, the ASP.Net Core docs, or diverse awesome lists, or the slides and materials from conferences like Stir Trek. Frequently, even as a non-developer, you may desire to contribute to such repositories, mayhap even just every bit simply as to add together a file or perhaps update a text file in your browser.
Unfortunately, GitHub doesn't make it extremely piece of cake to discover how to practise this if y'all don't already know the process and various jargon terms that are involved similar "forking" and "pull request" and then this post will demonstrate what's required to merely add a file to a GitHub repo you lot don't already ain.
Updating a File
If all you need to do is update an existing file, that's actually pretty piece of cake. Almost GitHub repositories accept a README.md file in their root. I'm going to use a repo that I'k not an owner of as an example – in this example AutoMapper.
Let's say I desire to add a link to the home page. Well, this page is displaying the contents of README.me, so I first need to click on that file. Note that you must be logged in for this to piece of work.
In one case you've clicked on the README.medico file, you lot should see a pencil icon in the summit correct. Mousing over it reveals:
Click to fork the project and edit the file.
Go ahead and click the icon. You lot'll be presented with a text editor view of the file, which uses markdown formatting. Scroll to the bottom – you should come across your GitHub icon and a title and description for your change.
Updating a file on a repo y'all don't own.
Once y'all click Propose file modify, a pull asking will be created and the owner of the repository will have a chance to review your change and either accept it, reject it, or discuss it with you.
Forks and Pull Requests
Two terms you should know are forks/forking and pull requests.
A fork of a project is a copy of the original at that betoken in time. If the original repository continues to exist updated, the fork won't see these updates (at least, not automatically). Y'all tin can utilise a fork of a project every bit a kind of backup, since it copies the repo to your account.
Forking is also used for collaboration. You can modify your copy of the original, and then submit your changes to the original repo. When you follow this process, your changes aren't automatically pushed back to the original repo. Instead, you have to request that the owner of the original pull your changes into their repo. Hence the term, pull request.
Pull requests compare any two branches. You can make pull requests within a repo or between a fork and its parent repo. A common mistake to picket out for, though, is to make a pull request from a branch and then proceed working on that co-operative. Any additional changes you make in that branch will also become part of that pull request! Thus, information technology's best to create a new branch for whatsoever particular change, and to go on pull requests small and focused.
Adding Files to Repos You Don't Own
Ok, now you've seen how to edit a file and you hopefully have at least some thought of what forks and pull requests are. Then how do you add a new file to a repo you lot don't own?
I'one thousand going to return to Automapper again for this instance. When I view the principal folio of the repo, I encounter this:
Note buttons for Create new file and Upload files…
GitHub exposes functionality to let me create a new file. If I click that push button, I'll get the same experience as if I edited a file, with the i add-on being that I can specify a file name. This might be fine for some scenarios, merely won't aid me if I'yard trying to add a PowerPoint or Nada file to the site.
Now, if I click Upload files, I get this helpful dialog:
Shouldn't the push accept been grayed out?
The GitHub repository says Uploads are disabled. File uploads require button access to this repository. This sounds like you're stuck, but you're not. You just need to use a pull request.
Note: Fifty-fifty if your experienced with GitHub, it's piece of cake to mess up the next step. Y'all need to recall to Fork the repository earlier you Clone it. At that place's cipher to prevent you lot from Cloning the repo you don't own, but without a Fork it'due south much harder for you lot to contribute to it.
At the very tiptop of the screen, click on the Fork push button. It's not bright and green, and it volition take some number side by side to it representing how many people have forked this repository in the past.
Fork, don't Clone, at this point.
Now that y'all've forked the repo, you lot should encounter something like this (but with your account name instead of 'ardalis'):
Note the modest text stating where the repo is forked from
Now we're ready for that big dark-green buttonon the right that says Clone or download. Click that, and cull Clone. Copy the URL (you tin can besides simply grab the repo's URL from the status bar). Make sure it has your username or organisation name in it, non the original one.
We're going to download the GitHub repo to our local computer. Open a control or terminal window and go to a binder where you want to copy the files. I typically have a binder like C:\dev\scratch for things I'g going to download once just don't plan on keeping around long term. Note that y'all need to have Git installed for this next step.
Enter the post-obit into the last window once you lot've navigated to the proper folder:
git clone https://github.com/ardalis/AutoMapper
Now we have a copy of our fork of the repo on our machine.
Now you have a re-create of the repo (your fork of the original) locally. Open information technology up in Windows Explorer (Finder on mac) and add the file you desire to upload to the appropriate folder. Once you lot're washed, become back to your console/terminal window and run these commands:
cd .\AutoMapper\ git checkout -b AddingFile git add . git commit -yard "Adding a file" git push Change the first line to be the actual folder where the repo is.
These commands volition create and check out a new branch, then add together any pending changes to the current fix of things to bank check in. You should run into it add the file y'all added. The side by side line checks in ("commits") the alter locally, just on your car. And the last command volition button the change to GitHub. Commonly if this is the first fourth dimension you're doing this, yous'll demand to add one more command:
Almost there!
Fortunately it tells you the exact command to run. Do it and yous should be all set. What you're doing is telling it to create a matching branch on GitHub called 'AddingFile' and to utilize that as the identify you're going to push your changes to. After running that command you should see this:
Our changes are on GitHub! Just one more than footstep!
Now get back to your fork of the repo in the browser. GitHub should helpfully offering to let you create a pull request correct from the home page, simply if non, go to the Pull requests tab.
Now just fill out the form and click Create pull request when you're done!
The owner(s) of the original repository will exist notified and they'll review your file change and determine whether or not to accept it. If they have questions or comments, they'll announced in the pull request and you should get notifications if you've enabled them. In whatsoever case, cheque the pull request URL to come across its status.
If this helped you, delight leave a comment or consider sharing this tweet to maximize reach:
How to Add together Files to a GitHub Repo Y'all Don't Ownhttps://t.co/lqW1TLZQBJ#git #github #programming #community #opensource #gitlab #dev #devdiscuss #devcommunity
— Steve "ardalis" Smith (@ardalis) May 3, 2019
Thank you!
Source: https://ardalis.com/how-to-add-files-to-a-github-repo-you-don%E2%80%99t-own/
0 Response to "How Do I Upload My Files to Github Fork"
Post a Comment