Main Content

Clone Git Repository

Create a new local copy of a project by retrieving files from Git™ source control.

  1. On the Home tab, click New > Project > From Git. The New Project From Source Control dialog box opens.

    Alternatively, on the Simulink® start page, click the Project from Git template.

  2. Enter your HTTPS repository path into the Repository path field.

  3. In the Sandbox field, select the working folder where you want to put the retrieved files for your new project.

  4. Click Retrieve.

    If an authentication dialog box for your repository appears, enter the login information for your Git repository account -- for instance, your GitHub® user name and password.

    If your repository already contains a project, then the project is ready when the tool finishes retrieving files to your selected sandbox folder.

    If your sandbox does not yet contain a project, then a dialog box asks whether you want to create a project in the folder. To create a project, specify a project name and click OK. The Welcome screen appears to help you set up your new project. For more information about setting up a project, see Create a New Project From a Folder.

You can now add, delete, and modify your project files. For details on how to commit and push the modified project files, see Commit Modified Files to Source Control.

Tip

Alternatively, to prevent frequent login prompts when you interact with your remote repository, you can clone a remote repository using SSH instead of HTTPS. To avoid problems connecting using SSH, set the HOME environment variable and use it to store your SSH keys. For more information, see Use SSH Authentication with MATLAB.

Troubleshooting

If you encounter errors like OutOfMemoryError: Java heap space when cloning big Git repositories, then edit your MATLAB® preferences to increase the heap size.

  1. On the Home tab, in the Environment section, click Preferences.

  2. Select MATLAB > General > Java Heap Memory.

  3. Move the slider to increase the heap size, and then click OK.

  4. Restart MATLAB.

Related Examples

More About