无法为每个git pull指定git子模块`
这个问题的基础是 我的.git模块在我家无法为每个git pull指定git子模块`,git,repository,git-submodules,git-pull,Git,Repository,Git Submodules,Git Pull,这个问题的基础是 我的.git模块在我家 [submodule "bin"] path = bin url = git://github.com/masi/bin.git 我的文件夹-我家的结构: ~ |-- [drwxr-xr-x] bin // this is the folder which I make a submodule // it is also a fol
[submodule "bin"]
path = bin
url = git://github.com/masi/bin.git
我的文件夹-我家的结构:
~
|-- [drwxr-xr-x] bin // this is the folder which I make a submodule
// it is also a folder where I have a Git to push my submodule's files
| -- fileA
` -- folderA
...
我跑
git submodule init # I get no output from these commands
git submodule update
git submodule foreach git pull
我跑
git submodule init # I get no output from these commands
git submodule update
git submodule foreach git pull
我明白了
Entering 'bin'
fatal: Where do you want to fetch from today?
Stopping at 'bin'; script returned non-zero status.
我修复这个bug的第一个假设是将path=bin
更改为path=/Users/Masi/bin
。然而,这并不能解决问题
如何从作为my Git子模块的外部存储库上载内容?这通常是在没有远程配置时发生的错误。
(来自) 这是一个补丁,它至少修复了在一个很久以前初始化的存储库中运行“git pull”时的回归问题,该存储库不使用.git/config文件指定远程存储库的位置 更好的信息可能是: 没有为当前分支配置默认远程设备,
默认的远程“原点”也没有配置 我认为这条信息在之前的文章中没有变得友好 在当时无法接近
因此,此消息表示.git/modules中提到的远程repo未在.git/config中声明 从 子模块不能与远程模块混淆,远程模块主要用于同一项目的分支
子模块用于您希望成为源代码树一部分的不同项目,而这两个项目的历史记录仍然保持完全独立,并且您无法从主项目中修改子模块的内容 我相信您可能错过了git子模块init的步骤: 子模块初始化 初始化子模块,即将.gitmodules中的每个子模块名称和url注册到.git/config
.git/config
中使用的键是子模块。$name.url
此命令不会更改.git/config中的现有信息。
然后,您可以在
.git/config
中为本地设置自定义子模块克隆URL,并继续进行git子模块更新;如果不打算自定义任何子模块位置,也可以只使用git submodule update--init
,而不使用显式init步骤
如果您的远程repo(在.git/modules中声明)在.git/config中被充分引用,那么您不应该再有此错误消息
在使用(pullin)子模块之前,请执行以下步骤:
git submodule init
git submodule update
仍然需要。你的bin子模块的.git/config是什么样子的?@Charles:My.git/config在这里看起来你的bin子模块是递归的???@为什么你认为bin子模块是递归的?如果你的bin子模块的
.git/config
文件也包含[子模块“bin”]
部分,然后子模块可以是递归的(也就是说,它包含自己作为子模块)。这可能会导致很多混乱。我运行这些步骤-我澄清了我的问题。换句话说,同样的问题也发生在命令上。这一点很好。我遇到了类似的问题,结果是在我的一个子模块中,我意外地将远程回购从origin重命名为upstream。将repo名称更正为origin,然后Git给出了一些更实用的建议——如果您希望为这个分支设置跟踪信息,可以使用“Git branch--set upstream master origin/”这样做。