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)