DEV Community

AMAR SINGH
AMAR SINGH

Posted on • Edited on

Pushing folders from local pc to GitHub using Git

Hello all,
In this post, I will be explaining the procedure to push our local projects, files etc to a GitHub repository in simple and elegant way!
First of all make sure to install Git in your computer and link your email and other things to it!

Now, head toward that folder which you want to push there on GitHub.
Then, Follow following steps-

  1. Open Git Bash in that particular folder.
  2. Type git init (this will make that folder a repository)
  3. Type git add . (this will add all files to the repository)
  4. Type git commit -m "Intial commit msg" (all files now in repository)
  5. Type git status (you will get a msg "Working tree clean")

These are the steps which are used to make a local repository, now to push the same to a GitHub repository we use following steps-

  1. Open your GitHub profile and create a New Repository.
  2. Copy the SSH Key of that created repository.
  3. Open Git Bash in that particular folder which you want to push.
  4. Type git remote add origin PASTE_SSH_KEY_OF_CREATED_REPO
  5. Type git push origin main --force

This will successfully push that folder to your GitHub account.
Thank You :)

Top comments (0)