Skip to main content

Modelbit clone

Your Modelbit workspace is backed by a git repository that supports large binary files like .pkl and .joblib. These files are not supported by git clone, so you must use modelbit clone instead.

If you haven't already, install Modelbit:

pip install modelbit

Then clone your Modelbit workspace's repository:

modelbit clone [target directory]

The clone command will display a link for you to click, just like when using modelbit.login() in a notebook. Click the link to authenticate with Modelbit.

If you have configured GitHub or Gitlab as your git remote, the clone command will ask you to choose between GitHub/Gitlab and Modelbit's git host. Both will work equally well. We recommend choosing Modelbit's git host if you've already uploaded an SSH key to Modelbit.

From here on you can use all the standard git commands like git push and git pull.

Git automation using API keys

To clone Modelbit's repo as part of a CI/CD process you can authenticate using API keys. First, create an API key in Modelbit. Then set the envvars MB_API_KEY to that key, and MB_WORKSPACE_NAME to the name of your Modelbit workspace. With those envvars set you can call modelbit clone:

export MB_API_KEY=<key> MB_WORKSPACE_NAME=<name>

# You can also set origin to 'github' or 'gitlab' to clone from that repo
modelbit clone --origin modelbit

Empty binary files or frequent rebasing

If you use git clone instead of modelbit clone to create a local repository you'll experience some issues:

  • You'll see "stubs" in place of the .pkl and other binary files stored in git
  • Your branch will be rebased by Modelbit, leading to some errors when you git pull or git push

Delete your local repository and re-clone it with modelbit clone to correct this situation.