clone
Creates and configures a git repository of your Modelbit workspace. Learn more about using git with Modelbit.
Don't use git clone with Modelbit workspaces. Using modelbit clone ensures your local repo is configured to work with Modelbit.
Parameters
modelbit clone [dirName]
[dirName]: Optional. Specify the name of the directory to use when creating the repository. Defaults to the name of your workspace.
Examples
Clone your modelbit workspace
This command clones your Modelbit repository into a new directory, named after your workspace.
modelbit clone
Clone into the my_workspace directory
This will clone your Modelbit repository into the my_workspace directory.
modelbit clone my_workspace
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>
modelbit clone
Using GitHub/GitLab as the origin
If you're not sure, just ignore this section and continue using Modelbit as the origin when interacting with Modelbit via git.
Modelbit maintains the git repository backing your workspace. By default, modelbit clone will use Modelbit's repository as the origin for your local repository.
Connecting an external origin like GitHub or GitLab to Modelbit allows Modelbit to track and maintain changes in that repo so you can perform code reviews and run CI/CD processes like your other git repositories. There's no need to change your origin to GitHub/GitLab after connecting a repository to Modelbit.
However, if you need to use GitHub/GitLab as your local origin, pass the --origin flag to modelbit clone:
modelbit clone --origin github
If you see 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
.pkland other binary files stored in git - Your branch will be rebased by Modelbit, leading to some errors when you
git pullorgit push
Delete your local repository and re-clone it with modelbit clone to correct this situation.