Can I arrange repositories into folders on Github?

Viewed 124916

I am new to git and what I am doing now is to upload all my recent projects as repositories to github. There are a lot of different projects like webdesign, wordpress themes and different types of applications. And some of these also belong to bigger projects because they were about testing some stuff as a different application.

The problem is that I have a confusing amount of repositories online now. How can I group related github repositories in a folder structure? Is there a feature providing any ability to order and structure or even tag repositories on github?

7 Answers

I use Organizations to arrange repos. This allows for clean delineation and clear organization, ripe for sharing if needed. For example:

My Organizations

  • Jmr-iOS (iOS repos)
  • Jmr-Work (Work repos)
  • User Acct (Pers repos)

All organization repos are public though unless you upgrade to an Enterprise Cloud account ($25/mo) As of September 2020 you can have unlimited public/private repositories under an Organization. (see options here)

This is not an answer so much as a heads up.

One recent side effect of structuring utilizing organizations has come to light due to the following announcement of free private repos for users: https://blog.github.com/2019-01-07-new-year-new-github/

Organization private repos are still not free. So using organizations to separate repos will result in your organization's inability to utilize free private repos, if that's something you need.

One possible way to simulate folders is by appending comma-separated tags to the end of your repo description. You can then search for repos by these tags, since the GitHub 'Find a repository...' filter looks in the repo description! An example:

MyRepo: Does some cool stuff [computer-vision, machine-learning, python]

For starters, you can tag repos now in GitHub, in the form of topics. Yay!

But I don't think it solves the bigger problem. For this, I have tried a top level folder system (where each project is a folder in one repo). I have also tried a one branch per project system (where each project is in a new branch). This last one allows you to pull and push each project separately too! But, neither is ideal.

You can also look into other version control systems like subversion and mercurial. Mercurial can also be hosted on Bitbucket if you need, and Facebook is even looking into support for "multi-project repositories".

I personally like the system of https://hg.openjdk.java.net/ (or http://hg.netbeans.org/), where you have a folder setup and each project is hosted at endpoints. The best way to achieve this is through creating a website (which you can do in GitHub) with your project structure (like https://mvnrepository.com/ or https://www.npmjs.com/).

Drawbacks with the Projects approach include:

  1. The project (i.e. "folder") in which a repo resides isn't usually visible, for example in the Homepage or your Profile. To make this visible in those places would require a manual tag in the repo's name, for example like @peter554 suggests. But then changing the "folder" (i.e. project) requires changing both the project and the manual tag in the repo's name.
  2. You cannot add forks to a project.

These problems are not present with the Organizations approach. However:

  • Your "foldered" repos will disappear from your account profile page. But organisations can be made visible there by becoming a public member. (can be set under "people" within organizations)

notice: These things may be subject to change as Github develops further.

So it is confirmed that there is no folder function in Github.

I think to organize repositories, you could have 2 approaches.

  • to use a file system, each file refer to one repository, they are just a link to GitHub, put them inside the folder with folder names as the categories ( a python script could generate all files, and you drag and drop)

  • organize using a directed graph ( no existing tool, you need to build a web or desktop app to do that, I am coding this out)

    • this
Related