1
$\begingroup$

I'd like to build Blender v3.0.0 as a python module in a docker container. Generally, the process seems to be pretty straight-forward, thanks to the multitude of tutorials.

However, cloning the blender repository with

git clone https://git.blender.org/blender.git

takes a very long time. I thought that I could speed it up by making only a shallow clone of the repository using

git clone -b v3.0.0 --single-branch https://git.blender.org/blender.git or

git clone https://github.com/blender/blender.git --depth 1 --branch v3.0.0

but that gives me the following error during make update:

Blender git repository is in detached HEAD state, must be in a branch

Is there a way around this?

$\endgroup$
3
  • 1
    $\begingroup$ How about you create a branch after cloning the repo? like git checkout -b my-branch ? $\endgroup$
    – Mehdi
    Dec 15, 2021 at 20:34
  • 2
    $\begingroup$ Well... I think that fixed it. :-) That was easier than suspected. I think I misinterpreted the error... Thank you very much. If you write an answer (maybe with a short explanation), then I'll be happy to accept it. $\endgroup$
    – Nos
    Dec 15, 2021 at 23:03
  • $\begingroup$ Thanks. I just posted it as an answer, using a different but equivalent command, as found in git documentation. $\endgroup$
    – Mehdi
    Dec 16, 2021 at 8:25

1 Answer 1

0
$\begingroup$

It appears that Blender's build process depends on a the git repository being checked out to a branch.

In Blender's git repository, v3.0.0 is a tag, rather than a branch.

The shallow clone works with tags, but once it finishes, the local repository is not checked out to any actual git branch, hence the error message about detached HEAD state (c.f. git documentation on checking-out tags).

To solve the problem, simply create a branch, with the current contents of the repo.

For example:

git switch -c <new-branch-name>

Then, you should be good to go :)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .