如何配置supdule遥控器并按下
我有一个第三方仓库作为子模型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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最终,我分配了外部回购的副本,并将其作为子模块。显然,对子模型进行更改,以便其他所有人都可以得到修改的外部回购不是子模块的主要用例,并且不先拨打就无法完成。
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.