git 我可以将存储库安排到 Github 上的文件夹中吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11852982/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I arrange repositories into folders on Github?
提问by danijar
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.
我是 git 新手,我现在正在做的是将我最近的所有项目作为存储库上传到 github。有很多不同的项目,如网页设计、wordpress 主题和不同类型的应用程序。其中一些也属于更大的项目,因为它们将一些东西作为不同的应用程序进行测试。
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?
问题是我现在有大量令人困惑的在线存储库。如何在文件夹结构中对相关的 github 存储库进行分组?是否有任何功能可以在 github 上订购和构建甚至标记存储库?
采纳答案by VonC
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.
在 GitHub 本身上,您不能按“文件夹”对存储库进行分组,除非您创建了组织。例如,
请参阅SublimeText,作为所有 sublimeText 包存储库的组。
But that won't support a nested folder organization. For now (June 2017), that only supports a nested teamorganization structure.
但这不支持嵌套文件夹组织。目前(2017 年 6 月),仅支持嵌套的团队组织结构。
Update February 2019: you now have the concept of project:
See "User owned projects—your personal workspace "
2019 年 2 月更新:您现在有了项目的概念:
请参阅“用户拥有的项目——您的个人工作区”
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
您还可以将最多 5 个存储库链接到您的项目板。链接存储库会将搜索范围限制为那些链接的存储库,因此您可以快速缩小尚未添加到项目板的任何新问题的范围
GitHub also supports tags now (in the form of topics).
GitHub 现在也支持标签(以主题的形式)。
Original answers 2012:
2012 年的原始答案:
Another solution is for you to define repositories which reference other repos, declared as submodules.
另一种解决方案是定义引用其他存储库的存储库,声明为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.
它在您的 GitHub 帐户本身上不会很明显(因为它仍然包含大量的存储库,甚至比父存储库更大),但是通过克隆一个父存储库,您将取回所有关联的子模块。
The issue 302mentioned in the commentsby AnneTheAgilein 2014 just references now (Nov. 2018) tbnorth/github_repo_tags
该问题302所提到的意见通过AnneTheAgile现在在2014年只是引用(11月2018)tbnorth/github_repo_tags
The small python programin 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.
此存储库中的小型 Python 程序使用 GitHub API 来获取您的存储库列表。并将它们的名称、描述和 URL 添加到一个新的仓库中,默认情况下称为 repo_tags。最初,每个“问题”都被标记为未分类,但您可以使用常规问题标记来随意标记它们。
重新运行时,
repo_tags.py
只会为回购创建问题。尚未包含在某个问题中。
回答by J-Dizzle
I use Organizationsto 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)
- Jmr-iOS(iOS 存储库)
- Jmr-Work(工作仓库)
- 用户帐户(每个存储库)
All organization repos are public though unless you upgradeto an Enterprise Cloud account ($25/mo)
除非您升级到企业云帐户(25 美元/月),否则所有组织存储库都是公开的
回答by Michael Gregtheitroade
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/
由于以下针对用户的免费私人回购公告,最近构建利用组织的一个副作用已经曝光: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.
组织私人回购仍然不是免费的。因此,如果您需要,使用组织来分离存储库将导致您的组织无法使用免费的私有存储库。
回答by peter554
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:
模拟文件夹的一种可能方法是将逗号分隔的标签附加到存储库描述的末尾。然后您可以通过这些标签搜索 repos,因为 GitHub 'Find a repository...' 过滤器会在 repo 描述中查找!一个例子:
MyRepo: Does some cool stuff [computer-vision, machine-learning, python]
MyRepo:做一些很酷的事情 [计算机视觉、机器学习、python]
回答by gagarwa
For starters, you can tag repos now in GitHub, in the form of topics. Yay!
首先,您现在可以在 GitHub 中以主题的形式标记 repos。好极了!
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.
但我不认为它解决了更大的问题。为此,我尝试了一个顶级文件夹系统(其中每个项目都是一个 repo 中的一个文件夹)。我还尝试了每个项目系统一个分支(每个项目都在一个新分支中)。最后一个也允许您分别拉取和推送每个项目!但是,两者都不是理想的。
You can also look into other version control systems like subversionand mercurial. Mercurial can also be hosted on Bitbucketif you need, and Facebook is even looking into support for "multi-project repositories".
您还可以查看其他版本控制系统,例如subversion和mercurial。如果需要,Mercurial 也可以托管在Bitbucket 上,Facebook 甚至正在研究对“多项目存储库”的支持。
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/).
我个人喜欢https://hg.openjdk.java.net/(或http://hg.netbeans.org/)的系统,在那里你有一个文件夹设置,每个项目都托管在端点上。实现这一目标的最佳方法是使用您的项目结构(如https://mvnrepository.com/或https://www.npmjs.com/)创建一个网站(您可以在 GitHub 中进行)。