How to Upload Code From File on Github
How to upload code to Github?
Well, there are two ways to do that :
- Through UI of github.com website
- By typing in commands from the command line
Though it is absolutely fine for beginners to employ the first method then shift to the command line and hence we are going to expect both ways to do that and very basics of them.
Then, I assume yous have a project which you want to upload or basically a folder in which some files are present and if non, then create ane following this:
Make a binder name 'project-01', inside that create a file alphabetize.html and write annihilation there doesn't matter, we just need to upload that cool affair.
Now, become to github.com and make your business relationship, make certain you put a cool username as you are going to be the next geek master of your college.
Step-1:
Movement your eye to the upper right corner of the website and click on this plus sign so click on the New repository.
Footstep-ii:
A screen will open up as below, requite your repository a proper name, keep it public and click on the checkbox displaying "Initialize this repository with a README" .
Step-3:
This screen should come up, if it is not coming make certain in the terminal step, you clicked the checkbox saying initialize it with readme. Now, in right side see a button saying upload files. Click on that
STEP-iv:
Below screen will come, at present click on the 'choose your files' link and motility within the folder project-01 and select all the files at once. And later that at lesser, a form will come, there blazon your message. For e.g., "completed the website" and leave the clarification part and click on commit changes button.
After this stride your lawmaking will be uploaded to github and now you tin can share your link to anyone proverb, look at my awesome work here.
METHOD-2:
If you are satisfied by uploading files through UI, its absurd go out this section but if yous want to know how you can practice same using the command line or a software called git, come on with me.
Go here and download the software i.e git for your operating system(No need to download if you are using Linux). Now, get inside the folder project-01. If yous are using windows, upon right click inside that folder, an pick will be at that place, 'open git bash hither' click on that and a blackness screen will appear. If you're on Linux, move within projection-01 directory through last.
Now scroll upwards and continue with step-1, but in step-ii, this time, don't click on the checkbox showing "Initialize this repository with a README" and click on create repository. Now a screen like this will appear
Now, get back to your blackness screen( or concluding or command line), and start copying and pasting these code snipetts,
echo "#test2">>README.doc
git init
git add .
git commit -thou "first commit"
git remote add origin https://github.com/your_username/repo_name.git
git push -u origin master
This will push your code to the Github in the aforementioned style equally we accept done in the METHOD-1, make certain you lot replaced the your_username and repo_name with your username and repository proper name.
So, this is all. I showed how to upload code to github which was the championship of this commodity but I accept not explained annihilation why we are doing this pace, because I don't desire to make this more tough for you, i step at once, now with time you will acquire why yous wrote git init, what is git remote and push, that all are with git.
If you want me to write further on this, let me know through comments. Thank you !!
Source: https://medium.com/@sauravbhagat_10426/how-to-upload-code-to-github-6db1c8ff56aa
0 Response to "How to Upload Code From File on Github"
Post a Comment