简体   繁体   English

仅使用.gitignore排除Github的子文件夹

[英]Exclude a subfolder only for Github with .gitignore

I have a project which is pushed to both of Github and Bitbucket repos: 我有一个同时推送到Github和Bitbucket仓库的项目:

git push github master
git push bitbucket master

Github is public, Bitbucket is private repo. Github是公开的,Bitbucket是私有的回购。

My problem is I use this repo to develop a side project inside which later will be a completely standalone one, but right now I'm using heavily this project's resources, so that's why I started the new project's rough code here. 我的问题是,我使用此存储库来开发一个副项目,该子项目在里面将是一个完全独立的项目,但是现在我正在大量使用该项目的资源,因此这就是为什么我在这里开始新项目的粗糙代码。 I want to hide this new project's code in this repo only from Github, because that's a public. 我只想从Github中将此新项目的代码隐藏在此回购中,因为这是公开的。 Is it possible within .gitignore with some Github specific prefixes? .gitignore是否可以使用某些Github特定前缀?

If it's not possible, than I start a new repo for the new project, but right now it's saves lots of common code for the new one. 如果不可能,那么我将为新项目启动一个新的存储库,但是现在它为新项目保存了许多通用代码。

For your side project inside which later will be a completely standalone one, you should reference your super project as a dependency. 对于内部项目(以后将成为完全独立的项目),您应将超级项目作为依赖项引用。

This means go ahead and create the new repository and push it to private remote. 这意味着继续创建新的存储库,并将其推送到专用远程服务器。 Then you've got at least 3 ways to include your public library: 然后,您至少有3种方式可以包含公共图书馆:

  1. Use a dependency manager like npm, composer, gem, or whatever is best for your language. 使用依赖管理器,例如npm,composer,gem或最适合您的语言的任何东西。

  2. submodules 子模块

  3. subtrees 子树

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM