How do I make a folder?

So I would like to use Github as a place to store my python programs, and I want them organized while they are here. But I cannot find how to make a folder to keep them sorted, can I have some help?

Jason

git doesn’t have a concept of “folders” by itself. Git tracks files and if a file happens to have a name like foo/bar/baz.txt, then when git recreates the repository locally it creates the foo folder, the foo/bar folder, and then the baz.txt file within the foo/bar folder.

So if you want to create a folder within a repository, you have to create a file within it. One common way people do this is to create an empty file named .gitkeep in the directory that they want to exist.

To create a folder this way through the GitHub web interface, you would follow the instructions for creating files. When it comes time to name the file, you would enter foo/bar/.gitkeep. You’ll notice that each time you press the / key, the GitHub UI recognizes that you mean to create a folder. Once you finish following the instructions, you’ll see that the folders and file exist, like I did on my test repo.

I hope that helps!

3 Likes