I want to create a folder in a GitHub repository and then add files to that folder.
How do I achieve this?
TL;DR Use /
in the file name field to create folder(s), e.g. typing folder1/file1
in the file name field will create a folder folder1
and a file file1
.
Original answer
You cannot create an empty folder and then add files to that folder, but rather the creation of a folder must happen together with the addition of at least a single file. This is because git doesn't track empty folders.
On GitHub, you can do it this way:
/
. This creates a folder.gitkeep
which is conventionally used to make Git track otherwise empty folders; it is not a Git feature though)