我知道以前曾有人问过这个问题,但是我找到了所有答案,只是给我快速解决问题的方法,或者是引起问题的原因以及如何解决的令人困惑的解释。
这是我遇到此错误的方式。我的一个队友在我们的仓库中推送了对子模块的更改。从母版git status
拉出后,在我们的子模块中显示了新的提交:
modified: path/to/submodule/submodule_name (new commits)
所以我决定通过运行来更新子模块
git submodule update path/to/submodule/submodule_name
-here is the doc for this command
这时我得到了错误
Fetched in submodule path 'path/to/submodule/submodule_name', but it did not contain ... Direct fetching of that commit failed
谷歌搜索后,我发现了不同的答案:
超级用户是使我更加了解该问题的链接,而github只是将运行该问题的命令交给了我-git submodule sync
现在,我对git status
中的更改显示方式仍然有些困惑,但是当我尝试更新服务器时却不知道该提交。 git submodule sync
怎么做才能使提交可用?
答案 0 :(得分:2)
您的错误消息确实提到:
# Test4.py
import test3
import time
objectTest = test3.test1()
def interface():
A = objectTest.collectData() #call collectData from tset3
B = (objectTest.name) #call Instance attribute from test3
print(B) #for testing purpose
print(A) #for testing purpose
while True:
interface()
time.sleep(1)
# Test3.py
import random
import time
class test1:
def __init__(self):
self.name=[]
def collectData(self):
temp=[]
#temp = list(self.name) # for testing purpose
enter code heretemp = self.name.copy()
print(temp) # for testing purpose
return temp
def engine(self):
while True:
self.name.append(random.randrange(1,20))
self.collectData()
self.name.clear()
time.sleep(2)
if __name__ == '__main__':
object1 = test1()
object1.engine()
这是典型的在子模块原始克隆存储库中完成的提交...未推回其远程存储库。
但是子模块存储库的新状态记录在已推送的父存储库中。
意思是:
父回购引用了子模块回购的提交,但从未提交到子模块远程URL:从克隆进行更新将:
您的队友确实推送了父存储库更改(特别是子模块的新状态),但没有推送该子模块中完成的提交。
答案 1 :(得分:0)
您似乎需要递归同步子模块。试试这个:
git submodule sync --recursive