DEV Community

Shivansh Mishra
Shivansh Mishra

Posted on

Want to upload a project on GitHub?

Setup git in your system

  • Install git in your system.

  • Signup/login in your GitHub account.

  • Create a repository in GitHub.


Upload a project in GitHub

If you're uploading first time

  1. Create your project folder 📁 and open it in VS code.(Make sure in the folder atleast one file is present)

  2. Run these commands in VS code terminal 🧑‍💻.

This command initialise git in your folder 👇

git init
Enter fullscreen mode Exit fullscreen mode

This command make the files ready to upload. This command add all file in your folder if you want to upload a specific file replace "." with file name and extension for eg "index.html" 👇

git add .
Enter fullscreen mode Exit fullscreen mode

This command basically save the history of your changes and ' -m "First commit" ' this is a message of commit 👇

git commit -m "First commit"
Enter fullscreen mode Exit fullscreen mode

By default your branch is master to change the project branch we use this command. 👇

git branch -M main
Enter fullscreen mode Exit fullscreen mode

This command tells you folder to go specific repository. 👇

git remote add origin https://github.com/your_username/repository_name.git
Enter fullscreen mode Exit fullscreen mode

This is the last command that push your changes in GitHub in main branch 👇

git push -u origin main
Enter fullscreen mode Exit fullscreen mode

Top comments (0)