This is a noob question but I'm under the gun to resolve this. I've inherited an odd problem with a git subtree that appears to be repo corruption.
Here's the scenario : a subtree of a git-based project A is being used in project B. Part of the deploy script use pushes the subtree out to project B's repo:
git subtree push -P sub/path/name --squash [email protected]:MyCo/project_b.git projectb_branch
it starts pushing the commits and fails with
"fatal: bad object {sha}"
I've searched for the SHA in the source repo's git log. It shows up in a commit:
git-subtree-dir: app/assets/ui
git-subtree-split: {sha}
The target repo (project_b) does indeed have a commit with that SHA but the source repo does not. I walked through the subtree shell script I can see that it's failing when it tries to look up that object with git log (in the toptree_for_commit function calling git log -l --pretty=format:'%T' {sha}).
At this point I am in way over my head but eager to try to find a solution. I've researched this as far as my limited knowledge permits, so I welcome any tips, tricks or RTFMs that can get me a little closer to a solution.
my sincere thanks!
git subtree lets you nest one repository inside another as a sub-directory. It is one of several ways Git projects can manage project dependencies. Why you may want to consider git subtree. Management of a simple workflow is easy.
I just ran into this issue and was able to resolve by:
git remote add shared $url
git fetch shared
git subtree push -P $prefix shared $branch
Might not help for all but saved me from having to hack on the repo structures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With