git 无法在子模块路径中找到当前的原点/主版本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40987847/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to find current origin/master revision in submodule path
提问by SoftTimur
In my project (which uses git
), I need to use a library, which is still in progress. I decided to create a submodule for that library, because I want to update from time to time its latest version (I don't plan to make my own change there).
在我的项目(使用git
)中,我需要使用一个仍在进行中的库。我决定为该库创建一个子模块,因为我想不时更新它的最新版本(我不打算在那里进行自己的更改)。
I did:
我做了:
git submodule add https://github.com/mb21/JSONedit.git
git commit -am 'added JSNedit submodule'
git push -u origin master
git pull origin master
Then, I did see the JSONedit folder in my local folder, and a link in my git folder online. But when I did git submodule update --remote JSONedit/
, I got the following errors:
然后,我确实在我的本地文件夹中看到了 JSONedit 文件夹,并在我的 git 文件夹中在线看到了一个链接。但是当我这样做时git submodule update --remote JSONedit/
,我收到以下错误:
fatal: Needed a single revision
Unable to find current origin/master revision in submodule path 'JSONedit'
Does anyone know what's wrong here?
有谁知道这里有什么问题?
回答by tehp
git pull --recurse-submodules
Running this in the main repository should do the trick.
在主存储库中运行它应该可以解决问题。
Alternatively, you could git checkout
the branch from which you want to pull while inside the submodule, and then run a git pull
.
或者,您可以git checkout
在子模块内部时要从中提取的分支,然后运行git pull
.
Results should be the same.
结果应该是一样的。
回答by M. Twarog
It seems that this problem was already solved in this thread: Git submodules - pulling into a new clone of the super project. In short you should try:
这个问题似乎已经在这个线程中解决了: Git submodules - pull into a new clone of the super project。简而言之,您应该尝试:
# rm -rf JSONedit
# git submodule update
回答by pranav
I faced the same problem. It got solved. the folder in which the submodule would be stored was there. when I deleted the folder manually, it got resolved.
我遇到了同样的问题。它得到了解决。存储子模块的文件夹就在那里。当我手动删除文件夹时,它得到了解决。