Your Guide to How To Add a Folder In Github

What You Get:

Free Guide

Free, helpful information about Files, Data & Cloud Storage and related How To Add a Folder In Github topics.

Helpful Information

Get clear and easy-to-understand details about How To Add a Folder In Github topics and resources.

Personalized Offers

Answer a few optional questions to receive offers or information related to Files, Data & Cloud Storage. The survey is optional and not required to access your free guide.

How to Add a Folder in GitHub: What You Need to Know

GitHub doesn't work quite like your desktop file manager. You can't simply right-click and create a new empty folder — and understanding why changes how you approach organizing your repositories entirely.

Why GitHub Doesn't Support Empty Folders

Git, the version control system that powers GitHub, tracks files — not directories. A folder with nothing in it is invisible to Git. This is a fundamental design decision, not a bug or oversight. It means that before you can add a folder to a GitHub repository, you need at least one file inside it.

This trips up a lot of new users who expect folder creation to work the way it does in Google Drive or Windows Explorer. Once you understand the file-first logic, the workarounds become obvious.

Method 1: Adding a Folder Through the GitHub Web Interface

The simplest approach for most users — no command line required.

  1. Navigate to your repository on github.com
  2. Click "Add file""Create new file"
  3. In the filename field, type your folder name followed by a forward slash (e.g., my-folder/)
  4. GitHub will automatically recognize this as a directory and drop your cursor into a new filename field
  5. Enter a filename (e.g., README.md or .gitkeep)
  6. Add some content, or leave a placeholder note
  7. Scroll down and commit the new file

The folder appears in your repository the moment the file is committed. The slash is the key — typing it signals to GitHub's interface that you're defining a path, not just a filename.

What to Put in a Placeholder File

If you're creating a folder purely for structure and don't have real content yet, a common convention is to add a file called .gitkeep. This is an empty file (or nearly empty) that exists solely to make Git acknowledge the directory. It's not an official Git feature — just a widely adopted community practice. Some developers prefer README.md with a brief description of what the folder will contain, which adds useful context for collaborators.

Method 2: Adding a Folder Using Git on the Command Line 🖥️

If you're working locally and pushing to GitHub, the process is straightforward: