My Development Notes

Programming Made Easier


Easy way to push your coding project to GitHub

Firstly, create a simple GitHub repository and give it a suitable name. Say, the name of your repository is Project_One. Now, copy the SSH or HTTPS code of your repository. In the next step, use the terminal to cd into the location of your choice where you want to copy the repository in your local PC. Next, clone the repository like so :

git clone <paste SSH/HTTPS code>

In the next step, cd into the repository and open the repository using your code editor (like VS-Code). Do the coding. When you’ve finished the project, open up the terminal, preferably inside your VS-Code and use the following terminal commands shown below :

git init
# initializes Git repository

git add .
# adds all the coding you've done

git commit -m "add a comment"
# adds all the commits with a comment

git branch -M main
# renames the main branch to 'main'

git push -u origin main
# pushes the code to GitHub repo 

This is one of the many ways in which you can push your coding project to GitHub. To know full details about Git and GitHub installation and usage, click here.


Posted

in

by

Tags:

Leave a Reply