279

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?

double-beep
  • 5,031
  • 17
  • 33
  • 41
danijar
  • 32,406
  • 45
  • 166
  • 297
  • 6
    @user478212 The question is about arranging repositories, not files within a single repository. – danijar Sep 03 '18 at 09:43
  • The closest of "folders" would be today "projects" (Feb. 2019): see [my updated answer below](https://stackoverflow.com/a/11859027/6309) – VonC Feb 10 '19 at 02:54
  • "Projects" don't directly simulate folders though. A more direct way to simulate folders could be to use description tagging, as described in [my answer](https://stackoverflow.com/a/54599908/6097525) below. – peter554 Feb 10 '19 at 21:58
  • 1
    Dec. 2021: you now have lists of repositories. See [my edited answer below](https://stackoverflow.com/a/11859027/6309). Not exactly folder, but a good alternative. – VonC Dec 09 '21 at 22:44
  • See also [GitHub Community Issue #4174: Support repository categories](https://github.com/orgs/github-community/discussions/4174) – Wyck Jun 28 '22 at 19:06

8 Answers8

132

Update Dec. 2021:

Lists are now available as a public beta

Lists level up the starring experience by making it easy to organize and curate your favorite repositories on GitHub.

You can create public lists that appear on your stars page at https://github.com/USERNAME?tab=stars.

Lists are available to everyone except enterprise managed users.

https://i0.wp.com/user-images.githubusercontent.com/6895176/145467599-0b91cecd-872e-4ca1-bc86-16df076da29d.png?ssl=1

However (June 2022), as illustrated by Wyck in GitHub Community Issue #4174: Support repository categories, the presentation is still lacking:

if I click the topic button, it shows me a list of all public repos marked with that same topic keyword.
Instead, I'd prefer if there was a way to view only repos within my organization marked with that topic.

I'd also like to see a top-level list of all topic that have been marked on any repos within my private organization, to serve as a top-level directory or table-of-contents of repos in my organization.


Original answer:

On GitHub itself, you cannot group your repos by "folder", unless you create organizations.
See SublimeText, for instance, as a group of all sublimeText packages repos.

But that won't support a nested folder organization. For now (June 2017), that only supports a nested team organization structure.


Update Aug. 2020: the README project allows you to add a profile page... in which you can list and organize your repositories any way you want. But that is a manual process (editing the page).


Update February 2019: you now have the concept of project:
See "User owned projects—your personal workspace "

You can also link up to 5 repositories to your project board. Linking repositories will limit the scope of the search to those linked repositories, so you can quickly narrow down any new issues you haven’t yet added to the project board

https://i0.wp.com/user-images.githubusercontent.com/3477155/52346373-734e2580-29ed-11e9-82ad-9e5f1ab8aa99.gif?resize=1024%2C512&ssl=1

GitHub also supports tags now (in the form of topics).


Original answers 2012:

Another solution is for you to define repositories which reference other repos, declared as submodules.

That way, when you are cloning one of the repos (which references other repos), called "parent repos", they will be cloned in their own directory, with a sub-directory per submodules.

It won't be visually apparent on your GitHub account itself (as it will still contains a large list of repos, even larger with the parent repos), but by cloning one parent repo, you will get back all its associated submodules in it.


The issue 302 mentioned in the comments by AnneTheAgile in 2014 just references now (Nov. 2018) tbnorth/github_repo_tags

The small python program in this repository uses the GitHub API to get a list of your repos. and add their name, description, and URL, to a new repo., by default called repo_tags. Initially each “issue” is tagged unclassified, but you can tag them as you please, using regular issue tagging.

When re-run, repo_tags.py only creates issues for repos. that weren't already covered by an issue.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 5
    ok so I have to use many organisations... it there any reason why you can't structure your reps by folders? – danijar Aug 08 '12 at 14:28
  • 4
    @sharethis no reason that I know of, except this isn't yet a feature proposed by GitHub. – VonC Aug 08 '12 at 15:05
  • 6
    Wish list note; Tags would also be ok for me. https://github.com/isaacs/github/issues/302 – AnneTheAgile Nov 20 '14 at 21:08
  • 8
    wow, incredible that such a large, well-developed, popular service doesn't support such a basic feature which has been around forever. – Michael Apr 07 '17 at 16:18
  • @VonC I'm not sure the new GitHub Projects feature is directly addressing the issue of arranging repositories into folders, especially if the limit is 5 linked repos per project board (although it is certainly a very useful feature). Perhaps my answer below that simulates folders through description tags more directly addresses the issue? – peter554 Feb 10 '19 at 21:09
  • 1
    @PeterByfield That is the only official workaround, so I will stick with that for now. – VonC Feb 10 '19 at 21:10
15

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)

DZet
  • 539
  • 3
  • 10
J-Dizzle
  • 4,861
  • 4
  • 40
  • 50
  • 2
    All organization repos are public, even if you upgrade to a developer account. So, if you need to upgrade your organization plan to enterprise or team (price nowadays starts from 25 euros a month and allows 5 developers, or you can use the enterprise from 21 dollars for each user, a month) – Curious Mind Aug 27 '19 at 10:17
  • good catch! I have updated to reflect the current schema, I am using this now – J-Dizzle Aug 27 '19 at 21:19
8

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.

6

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]

peter554
  • 1,248
  • 1
  • 12
  • 24
2

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/).

gagarwa
  • 1,426
  • 1
  • 15
  • 28
  • 2
    the problem is solved by other git providers like gitlab, so I wouldn't say that it is a problem with git specifically – gaurav5430 May 17 '21 at 20:17
  • @gaurav5430 Can you post this in the form of an answer, with more examples, so that others can also benefit? – gagarwa Jul 12 '21 at 03:12
2

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
Luk Aron
  • 1,235
  • 11
  • 34
1

The git repo and git repos represent the services for the business domain they belong to. As such, it makes sense to own those repos by teams. You may create a team and add the repos that are owned by that team. Access can also be managed better with team's concept.

The idea is inspired from Team Topology

SenG
  • 713
  • 1
  • 7
  • 15
0

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.

DZet
  • 539
  • 3
  • 10