Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • jQuery
  • AngularJS
  • ReactJS
  • Next.js
  • React Native
  • NodeJS
  • Express.js
  • MongoDB
  • MERN Stack
  • PHP
  • WordPress
  • Bootstrap
  • Tailwind
  • CSS Frameworks
  • JS Frameworks
  • Web Development
Open In App
Next Article:
How to Push Folders From Local PC to GitHub using Git Commands?
Next article icon

How to Push Folders From Local PC to GitHub using Git Commands?

Last Updated : 16 May, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Git offers a powerful command-line interface for managing code repositories, understanding how to push folders from your local PC to GitHub repositories using Git commands can enhance your workflow and streamline the process of sharing code with collaborators or deploying projects.

In this article, we'll see the step-by-step process of pushing folders from your local PC to GitHub using Git commands.

Why Push Folders to GitHub?

Pushing folders from your local PC to GitHub repositories is important for several reasons:

  1. Code Sharing: Uploading folders to GitHub allows you to share your codebase with collaborators, contributors, or the wider community.
  2. Backup and Versioning: By storing your code on GitHub, you benefit from version control, enabling you to track changes, revert to previous states, and maintain a backup of your project.
  3. Collaboration: Pushing folders to GitHub facilitates collaboration by providing a centralized platform for team members to access, review, and contribute to the codebase.

Steps To Push Folders to GitHub

First of all, make sure to install Git on your computer. Now, head toward that folder that you want to push there on GitHub. Then, follow the following steps. 

Step 1. Open Git Bash in that particular folder. Type git init (this will make that folder a repository)

Git initialization

Step 2: Type git add . (this will add all files to the repository)

Git add

Step 3. Type git commit -m "Initial commit msg" (all files now in the repository)

git commit -m "Initial commit msg

Step 4. Type git status (you will get a msg, "On branch master nothing to commit, working tree clean" this shows your local repository is finally created)

git status

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

Step 1. Open your GitHub profile and create a New Repository. Copy the SSH Key of that created repository.

creating new repository


Step 2. Open Git Bash in that particular folder that you want to push. Type git remote add origin PASTE_SSH_KEY_OF_CREATED_REPO. Then type git push origin master --force (type 'main' in place of the 'master' if your default branch is master). Please refer to the following picture (if needed):

How to Push Folders From Local PC to GitHub using Git Commands?

Now, refresh your Github page, you will be able to see your committed folders/files there.


Next Article
How to Push Folders From Local PC to GitHub using Git Commands?

A

amarsingh07
Improve
Article Tags :
  • Web Technologies
  • Git
  • GitHub

Similar Reads

    How to Push Anything to GitHub using Git Bash?
    GitHub has become the go-to platform for collaborative software development, offering powerful tools for version control, collaboration, and project management. Git Bash, a command-line interface for Git on Windows, provides a quick way to interact with GitHub repositories. In this guide, we'll lear
    3 min read
    How to Clone Web Project From GitHub in Pycharm Using Git?
    PyCharm is one of the most popular Integrated Development Environments (IDEs) for Python development. It provides robust support for version control systems like Git, making it easy to manage your code and collaborate with others. Cloning a web project from GitHub into PyCharm is a simple process th
    1 min read
    How to Generate Public SSH or GPG Keys Using Git Commands?
    Generating public SSH or GPG keys is important for securing your Git operations and ensuring the authenticity of your commits. In this guide, we'll walk you through the process of generating these keys using Git commands, making it easy to track along and understand.What Are SSH Keys?SSH (Secure She
    2 min read
    Push Codes from Linux (UBUNTU) To GitHub using SSH KEY
    GitHub, one of the most popular platforms for version control and collaboration, offers multiple authentication methods for interacting with repositories. SSH keys provide a secure and convenient way to authenticate and push code from a local machine to GitHub. In this article, we'll learn the step-
    4 min read
    How to Push Code to Github using Pycharm?
    Git is an open-source version control system. It means that whenever a developer develops some project (like an app or website) or something, he/she constantly updates it catering to the demands of users, technology, and whatsoever it maybe, Git is a version control system that lets you manage and k
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences