GitHub provides a user-friendly interface for managing your repositories directly from the web — including the ability to create folders (also known as directories) without needing to use Git or the command line.
In this guide, you’ll learn how to create a new folder inside a GitHub repository using the GitHub website.
✅ Step-by-Step: Create a Folder in GitHub Repository
🔹 Step 1: Navigate to the Repository
- Go to https://github.com.
- Navigate to your desired repository.
🔹 Step 2: Create a New File
- Inside the repository, click the “Add file” dropdown.
- Select “Create new file”.
🔹 Step 3: Use Slash /
to Create a Folder
In the filename input box:
folder-name/filename.txt
Example:
docs/readme.md
This will:
- Automatically create a folder called
docs
- Create a file named
readme.md
inside it
Note: GitHub does not allow creating empty folders. A folder must contain at least one file to exist in the repository.
🔹 Step 4: Commit the New File
- Scroll down to the “Commit new file” section.
- Add a commit message like
"Add docs folder with readme.md"
. - Choose whether to commit to the
main
branch or create a new branch. - Click “Commit new file”.
📁 Tip: Create Nested Folders
You can create multiple nested folders by adding more slashes:
folder1/folder2/folder3/filename.md
GitHub will create the full folder structure automatically.
✅ Summary
Task | How to Do It |
---|---|
Create a folder | Use folder-name/filename.ext format |
Create nested folders | Use folder1/folder2/filename.ext |
Commit file | Add a message and click “Commit” |
Cannot create empty folder | Must include at least one file |
🚀 Final Thoughts
While GitHub doesn’t support empty folders, its intuitive file creation feature makes organizing your repository simple. By naming a file with slashes (/
), you can build a structured folder system to keep your project organized and readable.