How to Create a Folder in GitHub (Step by Step)
Creating folders in GitHub helps you keep files organized and your projects easier to manage. You can set them up directly on the GitHub website or from your local computer using Git commands. Here’s a step by step guide to help you create a folder in GitHub.
Table of contents
How to Make a Folder in GitHub?
1. Create a Folder on GitHub Website
The simplest way to make a folder is from the GitHub interface itself.
- Open your GitHub repository
- Click Add file and select Create new file

- In the file name field, type the folder name followed by a slash, for example
docs/README.md - Add some content to the file and click Commit new file
This creates a folder instantly and places the file inside it. For other essential tasks, you might also want to learn how to delete a branch in GitHub.
2. Create a Folder Locally with Git
If you prefer more control, you can create folders on your local machine and then push them to GitHub.
- Open your terminal or command prompt
- Navigate to your repository with:
cd repo-name - Create a new folder with:
mkdir folder-name - Place a file inside the folder with:
touch folder-name/README.md
- Save and push the changes:
git add .
git commit -m "Added folder"
git push
GitHub does not recognize empty folders, so adding at least one file is necessary. While working locally, it can also help to know how to merge branches in GitHub.
When working with local repositories and pushing changes, you may sometimes run into merge issues. For detailed steps on fixing them, see how to resolve conflicts in GitHub.
After you push the new folder to the remote, the next step is often a code review in a pull request, so learn how to approve a pull request on GitHub to complete the workflow.
You may also want to change the default branch in GitHub to ensure new pull requests and commits target the right line of development; see this step by step guide on how to change the default branch in GitHub.
Why GitHub Requires a File
Git is designed to track files rather than empty directories. This is why a folder only shows up in your repository if it contains something inside. Developers often add placeholder files such as .gitkeep or README.md to make sure their folders remain visible. If you ever need the reverse process, check this guide on how to download a folder from GitHub.
FAQs
You can type slashes in the file path, for example src/components/button/index.js, and GitHub will create all the necessary folders automatically.
No. A folder must have at least one file for GitHub to display it.
The website method is easiest for quick changes, while using Git locally gives you more flexibility.
Yes. You can move the files into a new folder with the name you want, then remove the old one.
Conclusion
Making folders in GitHub is straightforward once you know the steps. The website option is quick for small adjustments, while creating folders locally is better for project work. No matter which method you choose, remember that every folder needs a file inside to be stored properly.
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
User forum
0 messages