Create New Repository

Create Git Repository on Your Local System

If you want to add version control to your files without sharing with another user, it is quickest to create a Git™ repository and sandbox on your local system. To instead clone an existing remote Git repository, see Retrieve Files from Git Repository.

Note

Before using source control, you must register binary files with your source control tools to avoid corruption. For more information, see Register Binary Files with Git.

To create a Git repository and sandbox on your local system:

  1. Right-click in the white space (any blank area) of the MATLAB® Current Folder browser and select Source Control > Manage Files. MATLAB opens the Manage Files Using Source Control dialog box.

  2. In the Source control integration list, select Git.

  3. Click the Change button. MATLAB opens the Select a Repository dialog box.

  4. Click the Create a Git repository on disk () button.

  5. Select an empty folder or create a new folder in which you want to create the repository and then click Select Folder. MATLAB creates the repository, closes the dialog box and returns to the Select a Repository dialog box.

  6. Click Validate to check the path to the new repository, and then click OK. MATLAB closes the dialog box and returns to the Manage Files Using Source Control dialog box.

  7. In the Sandbox field, specify the location for your sandbox. The selected folder must be empty.

  8. Click Retrieve to create the sandbox.

After creating the Git repository and sandbox, add your files to the sandbox. Then, commit the first version of your files to the new repository. For more information, see Mark Files for Addition to Source Control.

You also can change the repository URL after the repository is created. In the Current Folder browser, in a folder under source control, right-click, and select Source Control > Remote and specify a new URL.

To use a Git server for the repository on your local system, you can use a Git server hosting solution or set up your own Apache™ Git server. If you cannot set up a server and must use a remote repository via the file system using the file:/// protocol, make sure that it is a bare repository with no checked out working copy.

Create SVN Repository

You also can add version control to your files by creating an SVN repository. To instead check out an existing SVN repository, see Check Out from SVN Repository.

Note

  • Before using source control, you must register binary files with your source control tools to avoid corruption. See Register Binary Files with SVN.

  • Check that the folder you want to use for your SVN sandbox is on a local hard disk. Using a network folder with SVN is slow and unreliable.

To create an SVN repository:

  1. Right-click in the white space (any blank area) of the MATLAB Current Folder browser and select Source Control > Manage Files. MATLAB opens the Manage Files Using Source Control dialog box.

  2. In the Source control integration list, select SVN.

  3. Click the Change button. MATLAB opens the Specify SVN Repository URL dialog box.

  4. Click the Create an SVN repository in a folder () button.

  5. Select an empty folder or create a new folder in which you want to create the repository and then click Select Folder.

    MATLAB creates the repository in the selected folder, closes the dialog box and returns to the Specify SVN Repository URL dialog box. The URL of the new repository is in the Repository box, and the project automatically selects the trunk folder. Specify file:// URLs and create new repositories for single users only. For multiple users, see Share a Subversion Repository.

  6. Click Validate to check the path to the new repository, and then click OK. MATLAB closes the dialog box and returns to the Manage Files Using Source Control dialog box.

    If your SVN repository has a file URL, a warning appears that file URLs are for single users. Click OK to continue.

  7. In the Sandbox field, specify the location for your sandbox. For example, select the folder that contains the files that you want to add to source control

  8. Click Retrieve to create the sandbox.

After creating the SVN repository and sandbox, you can commit the first version of your files to the new repository. For more information, see Mark Files for Addition to Source Control.

Related Topics