I have two repositories: parent
and child
. They both use git-lfs. I am trying to import child
as a subtree into parent
.
When in the parent
directory, I try adding it and I get the following:
> 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
In the log file, I see
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
Which I guess makes sense, since the binary files for child
wouldn't be on the server for parent
.
So, I tried adding the child
lfs files to parent
like this, from the parent
directory:
git remote add child [child_url]
git fetch child
git lfs fetch
git lfs fetch child --all
git lfs push origin --all
Everything works fine until the last command. The git lfs push
doesn't push anything:
> git lfs push origin --all
Git LFS: (0 of 0 files, 1 skipped) 0 B / 0 B, 210 B skipped
It appears that it's only pushing to parent
files that exist on parent
branches.
The only way I could figure out how to add these lfs files to parent
was to add the child
branch to the parent
.
git checkout -b temp_branch child/master
git push origin
This then lets me successfully call git subtree add --prefix child [child_url] master
.
But, since I don't want temp_branch
on parent
, I must immediately delete it.
git branch -D temp_branch
git push origin --delete temp_branch
This works, but it feels really kludgey.
Is there a better way to call git subtree add
when the subtree repository is using git-lfs?