GitHub包含来自另一个存储库 [英] GitHub include from another repository

查看:96
本文介绍了GitHub包含来自另一个存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是github的新手.

I'm new to github.

我的机器上有一个github存储库.我想将另一个存储库(作为第三方)包含在我的存储库中.我相信我应该先叉.但是如何将其包含在本地存储库中?

I have a github repo on my machine. I want to include another repo (as a third party) into my repo. I believe I should make a fork first. But how do I include it on my local repo?

我尝试过子模块,但没有成功...

I've tried submodules but with no success...

谢谢.

推荐答案

git子模块仍然是推荐的方式:您可以声明( git submodule add )不属于您的东西或叉子(根据定义,给你).

git submodule remains the recommended way: you can declare (git submodule add) a repo which doesn't belong to you, or a fork (which, by definition, belongs to you).

尽管不要忘记,

  • 您仍然需要git submodule update --init才能看到该子模块存储库及其完整内容显示在您的存储库中
  • 添加并提交代表根目录的特殊条目您的主(父)存储库中该子模块的目录,然后推送该提交,以验证该声明.
  • you still need to git submodule update --init in order to see that submodule repo being displayed with its full content in your repo
  • add and commit the special entry representing the root directory of that submodule in your main (parent) repo, and push that commit, in order to validate that declaration.

这篇关于GitHub包含来自另一个存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆