Main Content

Clone Remote Git Repository into New Project

To create a new project from an existing repository:

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

  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 personal access token.

    If your repository already contains a project, 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 Set Up Project.

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 Project Files.

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 or install a credential helper. To avoid problems connecting using SSH, set the HOME environment variable and use it to store your SSH keys. For more information, see Configure MATLAB to Use Git SSH Authentication and Install Git Credential Helper.

If you encounter errors like OutOfMemoryError: Java heap space when cloning large Git repositories, 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 Topics