how to upload folder in github

How to Upload Folder to GitHub

By Anthony Anderson
AD

Uploading a folder to GitHub is a crucial skill for version controlling your projects. Here's a step-by-step guide to help you master this process.

Before we dive in, ensure you have Git installed on your computer. If not, you can download it from the official Git website and follow the installation instructions.

Preparing Your Folder for GitHub

First, let's initialize your local folder with Git and add your files. Open your terminal or command prompt, navigate to your folder, and type:

AD
Uploading Files and Folders to GitHub
Uploading Files and Folders to GitHub
Beginner’s guide to GitHub: Uploading files and folders to GitHub
Beginner’s guide to GitHub: Uploading files and folders to GitHub
How to Download Files and Folders From GitHub
How to Download Files and Folders From GitHub

git init to initialize a new Git repository.

Add and Commit Your Files

Next, add your files to Git using the git add command. To add all files in your folder, use:

How to Get Started With GitHub in 2026 and Build Real Projects Fast
How to Get Started With GitHub in 2026 and Build Real Projects Fast
Learn What is GitHub and How to Send Requests in GitHub - Codecondo
Learn What is GitHub and How to Send Requests in GitHub - Codecondo

git add .

Now, commit these files with a descriptive message:

AD

git commit -m "Your commit message here"

_connecting to GitHub Repository

Create a new repository on the GitHub website. Once done, you'll see a pop-up with instructions on how to connect your local folder to this repository. For now, copy the URL of the repository.

Back in your terminal, connect your local folder to this repository using:

AD

git remote add origin YOUR_REPOSITORY_URL (replace YOUR_REPOSITORY_URL with the actual URL copied earlier)

Pushing Your Folder to GitHub

Now, let's push your local changes to GitHub. First, check your status using:

git status

AD

git push -u origin main (or master, depending on your default branch name) to push your changes to GitHub. You'll be prompted to enter your GitHub username and personal access token (PAT).

Cloning the Remote Repository

After a successful push, clone the remote repository to another local machine to verify the upload:

git clone https://github.com/YourUsername/RepositoryName.git

Replace "YourUsername" and "RepositoryName" with your actual GitHub username and repository name. Now, you should have your folder on GitHub and can access it from any device!

Remember to keep your local folder up-to-date with GitHub using git pull. Regularly pull changes from GitHub to ensure you're working with the latest version. Happy coding!

AD