gpt4 book ai didi

git - 添加一个跟踪 master 的 git 子模块

转载 作者:太空狗 更新时间:2023-10-29 14:14:07 26 4
gpt4 key购买 nike

我正在使用 git 1.8.4 并尝试添加一个子模块来跟踪另一个存储库的 master。我尝试按如下方式添加它:

git submodule add -b master /path/to/myrepo.git

当我尝试添加它时出现以下错误

Cloning into 'myrepo.git'...
warning: You appear to have cloned an empty repository.
done.
fatal: Cannot update paths and switch to branch 'master' at the same time.
Did you intend to checkout 'origin/master' which can not be resolved as commit?
Unable to checkout submodule 'myrepo'

我不确定这是什么意思...有人可以解释一下吗?

最佳答案

子模块似乎没有分支的事实(即:“cd submodule ; git branch -avvv”没有返回任何东西,意味着父 repo 中的子模块配置是'正确初始化和更新。

commented :

One way to move forward would be to start from a fresh clone of the parent repo (without any reference to your submodule), and repeat the steps:

git submodule add -b master /path/to/myrepo.git ; 
git submodule update --remote --init. –

关于git - 添加一个跟踪 master 的 git 子模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18895661/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com