How to Add project to GitHub.

Kasun Weerasinghe
6 min readSep 21, 2022

--

image link:- https://www.simplilearn.com/ice9/free_resources_article_thumb/git_vs_github2.jpg

Today I'm going to talk about how to add our project to GitHub and for that first, we need to find out what git and GitHub these are 2 different things and we need Git to do this process.

what are Git and GitHub and why do developers need GitHub?

The simplest way to explain this Git is a version control system and GitHub is a cloud-based hosting service. Every developer uses GitHub to upload their project and Git hub is also used to work together with several people on the same project.

References:- https://devmountain.com/blog/git-vs-github-whats-the-difference/

Now let's see how to add/upload our project to GitHub.

  1. First, you need a GitHub Account. if you don’t have one go to this link and you can create one in just a second. after creating your account you can follow other developers and see what projects are they working on.
This is what My GitHub Home page looks like. 😎 Right.

2. Now we have to install git into our PC/Laptop. o, don’t worry this is easy peasy. go to the Git website and press the download button inside the desktop icon 👇🏻. I’m using so press “Download for mac” if you are using windows or Linux it will change to “download for windows”, or “download for Linux”.

for Mac users.

after you press download for mac it opens a new window like this. In there you can see there has a code under the Homebrew $ brew install git you can copy that code and paste it into the terminal and press enter. it will take a few minutes to install. you can terminal using search (command+spacebar) or Launchpad.

and after downloading you can check running this code git — version (windows/mac/Linux) and that tells us which version are you running. if isn’t showing anything check if you did the steps correctly.

Now Git is working on our machine.

2. How to create a new repository on GitHub?

a repository like a place you gonna upload your project we call it a repository. To do that, go to the GitHub you created before, press + sign on top, and select New Repository.

after selecting New Repository you can see this kind of window.

Create New Repository Section

Here as you can see you can enter a project name under the Repository name like I entered Java-Script. and also can add a description for this project as you like to describe what kind of project is this or what you used it for. under that you can see there have 2 options to select public and private. if you select public, anyone can see it, but if you choose private only, you can see that repository. and under all that, there have a button Create repository if you don’t have to change anything press that button, and after that your repository will create.

3. How to link the GitHub repository and our local machine project?

after you press Create repository this kind of window will open 👇🏻. just don't be afraid of those codes 😉. and don’t close this window.

now go to your project. in my case, it's on the desktop. I need to upload this Java-Script-master project to the repository we create.

to do that there have a few codes to run. you can do that using code editor(vs code/ Intellij IDEA) or local machine terminal in my case I will do that using terminal.

inside Script-master folder

Inside the Java-Script-master folder, those are the files I need to upload. to do that you have a few options you can set a path on the terminal like cd/desktop/java-Script-master, or you can do that as I do in this video. type cd on your terminal and drag and drop your project into the terminal and press enter. Now you are in your folder.

now there have 3 simple codes you have to type in your terminal.

git init

git add .

git commit -m ‘ add my project into a git repository

inside git commit -m ‘you can tell what you did’

now go to your GitHub where we create a new repository before.

copy the link git remote add origin …… and paste it into your terminal(red color code). after that copy the last code git push -u origin main and change it to git push -u origin master. (green color code)

after entering the link provide from GitHub and git push -u origin master code.

after you refresh your GitHub page now it looks like this 👇🏻.

after adding your project to GitHub.

as you can see the job is done. here you can go to settings and change settings and you can delete your repository. right side you can see what language you use in that project like my project is HTML and javascript. press the button Add README and describe to other developers what is in this project. after doing some change or adding something new to the project do the steps we did before. we don't need git init part and the link GitHub provide.

git add .

git commit -m ‘change new image into the header section

git push

git push is you push your code to GitHub that's what it means.

this is how you upload your project to GitHub. every developer needs to use GitHub because it's so much helping for them. For example, you can show how much you work by showing GitHub.

like this. it will show how much I work the past few days. you can see this diagram under your profile section. so I think this will help you to understand how to upload your project.

If you want to connect with me on LinkedIn and this is my GitHub page if you wanna check what kind of project I'm working on.

--

--

Kasun Weerasinghe
Kasun Weerasinghe

Written by Kasun Weerasinghe

Hi there! 👋 I'm Kasun, Front-End Developer. With a deep love for technology and innovation.

No responses yet