如何配置supdule遥控器并按下

发布于 2025-01-27 23:50:11 字数 1364 浏览 4 评论 0原文

我有一个第三方仓库作为子模型sub生活在parent/data/data/中。 在parent/data/sub/中,git状态

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

显然给了我,我已经对子模型进行了更改,并且我的本地提交已被识别,但尚未推动。因为远程origin/master,第三方仓库,所以如果我只是简单地git push,我就会获得权限。但是,将我的自定义和本地更改推向原始第三方并不是我的目标,因为我只打算自定义代码,以便可以在parent> parent项目中使用。 另外,git show head给出了哈希abc123(用于说明目的的假人)和我所做的正确更改。

下,父/git subpodule状态给出了我

abc123 data/sub (heads/master)

vim .gitModules给我

[submodule "data/sub"]
    path = data/sub
    url = https://github.com/owner-id/sub

一切对我来说都很好。显而易见的问题似乎是上面提到的未加工提交。结果,当我在parent/data/sub@abc123上导航到我的仓库时,它显示了404。同时,当我尝试git git clone https://github.com/my时-id/parent.git - recurse-submodules它显示了

fatal: reference is not a tree: abc123
Unable to checkout 'abc123' in submodule path 'data/sub'

问题:如何将我的本地提交在sub中推到我自己的仓库中,以便当其他人clone> clone我的parent parent/data/sub是我的自定义版本吗?

I have a third party repo as a submodule sub living in parent/data/.
In parent/data/sub/, git status gives me

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean

Apparently, I've made changes to the submodule and my local commit is recognised but has not pushed. Because the remote is origin/master, the third party repo, I get permission denied if I simply git push. However, pushing my customised and local changes to the original third party is not my goal anyway, as I only intend to customise the code so that I can use in my parent project.
Also, git show HEAD gives a hash abc123 (made dummy for illustration purpose) and the correct changes that I've made.

Under parent/, git submodule status gives me

abc123 data/sub (heads/master)

and vim .gitmodules gives me

[submodule "data/sub"]
    path = data/sub
    url = https://github.com/owner-id/sub

everything seems fine to me. The obvious issue it seems is the non-pushed commit mentioned above. As a result, when I navigate to my repo online at parent/data/sub@abc123 it shows 404. Meanwhile, when I try to git clone https://github.com/my-id/parent.git --recurse-submodules it shows

fatal: reference is not a tree: abc123
Unable to checkout 'abc123' in submodule path 'data/sub'

Question: how to push my local commits in sub to my own repo so that when others clone my parent the parent/data/sub is my customised version?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转瞬即逝 2025-02-03 23:50:11

最终,我分配了外部回购的副本,并将其作为子模块。显然,对子模型进行更改,以便其他所有人都可以得到修改的外部回购不是子模块的主要用例,并且不先拨打就无法完成。

Eventually I forked a copy of the external repo and made that as the submodule. Apparently making changes to submodules so that everyone else can get the modified external repo is not the main use case of submodule, and it can't be done without forking first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文