An essential trait of any software & IT professional is to learn, grow & build their career profile. The first step towards this would be to know ‘How to upload a folder on GitHub?’. But, how is this a growth factor?
GitHub is an online software development platform with the largest open source community in the world. It is primarily used for storing, tracking, & collaborating on software projects. Here, developers upload their own code files & collaborate with fellow developers worldwide on open-source projects.
Indeed, there are already millions of open source projects on GitHub.
This eventually encourages ‘Open-Source Contribution’, which is all about contributing to the development or improvement of open-source software. Altogether, It leads to many progressive benefits for any developer.
Benefits of contributing on GitHub
- Chance to get connected with like-minded techies
- Chance to improve the software you’re working on
- Chance to improve your coding skills
- Chance to Maintain the streak in contributions graph
But now, to get started on building your development journey, let’s get back to the basics.
How to upload a file on GitHub through a step-by-step approach?
Step #1: Download the Git from the official site- https://git-scm.com/downloads
Step #2: Install both the Git GUI and Git Bash.
Step #3: Below is the Folder Structure created in VSCode studio that Has to be Uploaded on GitHub. Don’t know how to create a folder? Learn to create a folder in VSCode here.
Step #4: After installing the git in the system. Right-click on the folder & check the option called Git Bash.
Step #5: Now, click on the Git Bash & you’ll see something like this below-
Step #6: Go to GitHub official account: https://github.com/, Create an account if you don’t have one & login.
Step #7: Now, create a repository in your GitHub account by clicking ‘New’ that appears on the left of your screen.
Step #8: Give a repository name & click on ‘Create repository’ as shown below.
More than 73 million developers use GitHub to discover & fork for their projects.
Step #9: Now, back to GitBash. Initialize the repository using the command: git init
Step #10: Copy the URL of your Git Repository & Add it to the command: git remote add origin https://github.com/MohanCloud-stack/myfirstreactapp.git.
This command helps you run the git remote add origin command from your local repository and pushes your code to the name of the active branch(Git repository).
Step #11: If the above command shows the error message, change the command to
git remote set-url origin https://github.com/MohanCloud-stack/myfirstreactapp.git
Step #12: Use the command: git remote -v to check the current URL in the repository
Step #13: Now run the command: git add.
The git add command adds a new file to the Git staging area – that contains a list of all the files you have recently changed.
Step #14: Next, Run the commit command: git commit -m “upload task for react”
This commit command keeps the track of our progress and changes as we make changes in the coding.
GitHub has over 67 million repositories(They already know how to upload the folder)
Step #15: Use git branch -M main command for changing the branch to the main branch.
Step #16: Next, run the git push origin main command for pushing the changes in the local branch to the Github repo. Didn’t understand?
Generally, by default, Git chooses origin for the remote & your current branch as the branch for pushing.
Now, if your current branch is main. Then, the command git push will supply the two default parameters—effectively running git push origin main.
Here, the origin remote is your GitHub repository, and the current branch is the main.
Step #17: A pop-up might appear after running the command in step #16. You can add your username and password of your GitHub account
For the Password of the GitHub account: use the personal access token inside the developer tools in the GitHub
Sometimes browsers ask for the authentication, and then accept the credential token in the browser.
Step #18: After following all of the above steps successfully, then a message will appear in the Git Bash terminal as shown below.
Step #19: Hurray! You’ve successfully uploaded a folder into the GitHub repository as shown below.
As you can infer from this blog already, GitHub is the world’s biggest host of source code. Are you interested in web development/Full stack development? Then, GitHub is a great platform that comes in handy.