Por*_*Man 7 git git-subtree git-lfs
我有两个存储库:parent和child. 他们都使用 git-lfs。我正在尝试child作为子树导入到parent.
在parent目录中时,我尝试添加它并得到以下信息:
> git subtree add --prefix child [child_url]
git fetch [child_url] master
From [child_url]
* branch master -> FETCH_HEAD
Downloading [child_binary_file_path] (12.55 KB)
Error downloading object: [child_binary_file_path] ([sha])
Errors logged to .git\lfs\objects\logs\20170613T115607.1992713.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge -- %f failed 2
error: external filter git-lfs smudge -- %f failed
fatal: [child_binary_file_path]: smudge filter lfs failed
Run Code Online (Sandbox Code Playgroud)
在日志文件中,我看到
Error downloading object: [child_binary_file_path] ([sha]): Smudge error: Error downloading [child_binary_file_path] ([sha]): [[sha]] Object does not exist on the server: [404] Object does not exist on the server
%+v
Smudge error: Error downloading [child_binary_file_path] ([sha]): [[sha]] Object does not exist on the server: [404] Object does not exist on the server
Run Code Online (Sandbox Code Playgroud)
我的猜测是有道理的,因为对于二进制文件child 不会在服务器上parent。
所以,我尝试从目录中添加childlfs 文件,parent如下所示parent:
git remote add child [child_url]
git fetch child
git lfs fetch
git lfs fetch child --all
git lfs push origin --all
Run Code Online (Sandbox Code Playgroud)
一切正常,直到最后一个命令。在git lfs push不压任何东西:
> git lfs push origin --all
Git LFS: (0 of 0 files, 1 skipped) 0 B / 0 B, 210 B skipped
Run Code Online (Sandbox Code Playgroud)
看来它只是推送到分支parent上存在的文件parent。
我能弄清楚如何将这些 lfs 文件添加到的唯一方法parent是将child分支添加到parent.
git checkout -b temp_branch child/master
git push origin
Run Code Online (Sandbox Code Playgroud)
这让我成功地调用了git subtree add --prefix child [child_url] master.
但是,因为我不想temp_branchon parent,我必须立即删除它。
git branch -D temp_branch
git push origin --delete temp_branch
Run Code Online (Sandbox Code Playgroud)
这有效,但感觉真的很笨拙。
git subtree add当子树存储库使用 git-lfs 时,有没有更好的调用方式?