git submodule update报错: error: Server does not allow request for unadvertised object

周末在家里做了一些工作,周一到办公室,执行git更新办公室电脑上的代码时,报错了

git submodule update –init faceapi-rpc-cpp/dependencies/common_source_cpp/
error: Server does not allow request for unadvertised object 50db78feb453236961657c9f2ff8c50ed0bbebaf
Fetched in submodule path ‘faceapi-rpc-cpp/dependencies/common_source_cpp’, but it did not contain 50db78feb453236961657c9f2ff8c50ed0bbebaf. Direct fetching of that commit failed.

怎么也没想明白是怎么回事儿,
在网上找了半天也没有找到解决办法,但大概知道就是在更新子模块时,服务器上找不到submodulecommon_source_cpp指定的commit 50db78feb453236961657c9f2ff8c50ed0bbebaf.
怎么会找不到提交呢?我笔记本上的代码都提交了呀。
其实就是项目主模块记录的submodule中的提交50db78feb453236961657c9f2ff8c50ed0bbebaf在服务器上的submodulecommon_source_cpp中并不存在。
想到这里我明白原因了:
我在家里工作时主项目的代码push到了git server,但忘记将submodule common_source_cpp也push到git server.
所以造成主项目中记录的submodule的HEAD超前,所以找不到指定的commit.

解决办法很简单:回头到笔记本上把submodulecommon_source_cpppush一下

再执行 git submodule update就正常了。

参考资料

《What does the git error message “Server does not allow request for unadvertised object” mean?》

猜你喜欢

转载自blog.csdn.net/10km/article/details/80308199