[英]git restore submodules - submodule directory created but empty
推送到生产时,子模块不会更新。 子模块根目录已创建,但里面没有文件
接收后
#/bin/sh
cd /var/www/repo
git --work-tree=. --git-dir=/var/git_repos/repo.git checkout master -f
git --work-tree=. --git-dir=/var/git_repos/repo.git git submodule update --init --recursive
浏览 github 时,子模块存在并与最新版本链接
当我从远程运行git push production master
时,我得到了这个
# git push production master
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 284 bytes | 284.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0), pack-reused 0
remote: Already on 'master'
remote: git: 'git' is not a git command. See 'git --help'.
remote:
remote: The most similar command is
remote: init
To ssh://domain.com/var/git_repos/repo.git
a710c83..6d75702 master -> master
正如我在讨论中提到的,我将首先使用git submodule update
,因为它会:
第二点“获取子模块中缺少的提交”是缺少的步骤,当您推送到基本仓库时,会触发错误消息
remote: fatal: failed to unpack tree object d09a53c53a7bd222df4869e66b9e45acee45e094
remote: error: Submodule 'php/repo/utils' could not be updated.
所以尝试使用脚本:
#/bin/sh
cd /var/www/repo
git --work-tree=. --git-dir=/var/git_repos/repo.git checkout master -f
git --work-tree=. --git-dir=/var/git_repos/repo.git submodule update --remote
^^^^
(no git there)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.