How can I switch the branch of the OctoPrint installation on my OctoPi image?

:spiral_notepad: Note

OctoPi 0.15.0 and later no longer includes a git checkout of OctoPrint by default. If you want to run any development branches of OctoPrint that aren't available as stable releases or release candidates, you'll first need to enable the git checkout by SSHing into your OctoPi instance and running ~/scripts/add-octoprint-checkout

You'll first need to ssh into your Pi or optionally connect it to an external keyboard and monitor and open a command line terminal.

:warning: Warning

Do not use sudo for the git, pip or python commands below!

If you need sudo in order to switch branches, you broke something on your OctoPi installation (probably by using sudo accidentally earlier) and you need to fix your permissions, not just blindly put sudo in front of commands until stuff works.

Perform the following steps:

cd ~/OctoPrint
source ~/oprint/bin/activate
git fetch
git checkout <branch>
git pull
python setup.py clean
pip install .
sudo service octoprint restart

Replace <branch> above by the branch you want to switch to, e.g. maintenance.

You'll want to switch the Software Update plugin to "Commit" tracking, otherwise you'll get prompted to reverting to a stable release.

1 Like