Follow the mentioned steps to upload your first codebase to GitHub:
- First of all, you need to install git on Windows. (Download Git from here)
2. Install the git in default settings.
3. After installing GIT, set your name as well as e-mail address in the Git configuration. This information will be displayed every time you make a new commit or changes.
4. Thereafter, type the below command to configure your name:
git config --global user.name "Your Name Here"
5. In the same way, you need to configure your email address by typing the command given below:
git config --global user.email "Your Email Here"
6. Now, head over to github.com and create a new repository in which you want to push your project.
7. Now, right-click on the folder containing the codebase which you want to push to GitHub and select “Open git bash here.” I will be pushing an “index.html” file which is inside my Github Demo folder which you can see in the below animation.
NOTE: HTML file should be named “index.html” only.
8. On clicking “Git bash here”, a new git bash terminal window will open!
9. Now, initialize the local directory as a Git repository by typing:
10. Now, you need to add the files to the staging area (git will only track the files inside this area). Run:
git add .
Typing the above command will stage all the files inside the local directory. If you want to stage only one file, type:
git add "file-name"
11. The next step is to commit your staged files by typing:
git commit -m "Type message of your choice here"
12. Now, copy the link to the repository which you created in step 6.
13. Now type :
git remote add origin <Paste-Git-URL-Here>
14. The last step is to push your codebase to GitHub. Type the command given below :
git push origin master
Refresh the repository page and you will see that your files are successfully pushed to Github.
Congratulations on uploading your first codebase on GitHub!