DEV Community

Oshadha Shiro
Oshadha Shiro

Posted on

How to add repository to GitHub ?

How to add repository to github

You should have git installed on your computer 👉 click here

Create a Repository on Github

image

Give name and description to your repository and click on create button.

image

Initialize a local repository

You can initialize a local repository by goto your project path in terminal and use this command

$ git init

Add files to the local repository

You can use this command to add all files to the local repository

$ git add .

or use this to and a specific file

$ git add <filename>

Commit the changes

Use this command to commit all files in the staging area

$ git commit -m "<commit message>"

Connect local repository to github repository

image

select http and copy http url from this page and use this command to connect local repository to github repository

$ git remote add origin <url>

Push files to github

Use this command to push all files to github

$ git push -u origin main

Now you have added your files to github successfully 🎉

I'm Shiro and ask any question below 👇

Happy Coding! 🚀

Top comments (0)