Creating folders inside a GitHub repository without using Git

GitGithubGithub Services

Git Problem Overview


I want to add a new folder to my newly created GitHub repository without installing the Git setup for (Mac, Linux, and Windows). Is it possible to do so?

I can't have Git all the time with me when I work on different systems/machines. I know how to add files directly in a repository on github.com/[USER]/[REPO]. Can we create a folder as well?

Git Solutions


Solution 1 - Git

After searching a lot I find out that it is possible to create a new folder from the web interface, but it would require you to have at least one file within the folder when creating it.

When using the normal way of creating new files through the web interface, you can type in the folder into the file name to create the file within that new directory.

For example, if I would like to create the file filename.md in a series of sub-folders, I can do this (taken from the GitHub blog):

Enter image description here

Solution 2 - Git

When creating a file, use slashes to specify the directory. For example:

Name the file:

repositoryname/newfoldername/filename

GitHub will automatically create a folder with the name newfoldername.

Solution 3 - Git

You can also just enter the website and:

  1. Choose a repository you have write access to (example URL)
  2. Click "Upload files"
  3. Drag and drop a folder with files into the "Drag files here to add them to your repository" area.

The same limitation applies here: the folder must contain at least one file inside it.

Solution 4 - Git

Another thing you can do is just drag a folder from your computer into the GitHub repository page. This folder does have to have at least 1 item in it, though.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsoftvarView Question on Stackoverflow
Solution 1 - GitsoftvarView Answer on Stackoverflow
Solution 2 - GitMalcolmView Answer on Stackoverflow
Solution 3 - GitDaniel MöllerView Answer on Stackoverflow
Solution 4 - GitElijah MockView Answer on Stackoverflow