How to upload GitHub project using terminal

Shrawan KansiShrawan Kansi
2 min read

How to upload git-hub project using terminal

Follow the steps given below to upload your first Project files to GitHub. First of all you need to install git on your system.

Install the git in default setting, after installing git you need to set your name and e-mail address in the git configuration. This information will be displayed every time you make a new commit.

Type the below command to configure your name:-


git config --global uder.name "your name here"

Similarly you need to Configure your email address by typing the command give below.

git config --global uder.email "your email here"

Now go GitHub.com and Create a new repository in which you want to push your project.

how to select project files for uploading on git/GitHub.

we can select two types

  1. select files which you want to upload and right click on file and go to Open with git bash.
  2. If you use VS-Code git auto select your files for Untarcked.

Now Click Git bash or VS-Code Terminal and initialization the local directory as a git repository by typing.

 git init

Now, you need to add the files to the staging area (git will only track the files insides this area) Run

git add .

Typing the above command and will stage all the files inside the local directory. if you want to stage only one file, type

git add "file name"

The next step is to commit your staged files by typing.

git commit -m "Type massage of your choice here"

after run this

git branch -M main

Now Copy the link to the repository which you Created

Now Type

git remote add origin <past your repository link here>

The last step is to push your project files to GitHub. Type the command given below

git push -u origin main

Refresh the repository page and you will see that your files are successfully pushed to GitHub.

Congratulation on uploading your first project on GitHub.

Git and GitHub Cheat Sheet

...Create a new repository on the command line

git init
git add README.md
git commit -m "first Commit"
git branch -M main
git remote add origin "<https://github/ your repo link here>"
git push -u origin main

...or push an existing repository from the command line

git remote add origin " repository link here"
git branch -M main
git push -u origin main

Thanks for Reading

0
Subscribe to my newsletter

Read articles from Shrawan Kansi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Shrawan Kansi
Shrawan Kansi