Clone Git Repository in MATLAB
You can clone a remote Git™ repository, for example, from GitHub® or GitLab® using HTTPS or SSH.
To clone a remote Git repository, follow these steps:
On the Home tab, in the File section, select New > Git Clone.
Alternatively, in the Files panel, in the folder you want to clone in, right-click and select Source Control > Clone Git Repository.
In the Clone Git Repository dialog box, specify the remote URL and the location of the folder you want to clone in. The folder must be empty.
If you use an HTTPS URL, enter the login information for the remote repository, if prompted. For example, enter your GitHub username and personal access token. For instructions on how to create personal access tokens for GitHub, see Creating a personal access token.
An example HTTPS URL is
https://github.com/<name>/<project>.git
.To prevent frequent login prompts when you interact with your remote repository using HTTPS, configure a Git credential manager to remember your credentials. For more information, see Manage Git Credentials.
If you use an SSH URL, you must configure MATLAB® to use SSH keys. For more information, see Configure MATLAB to Use Git SSH Authentication. Setting up SSH keys prevents frequent login prompts when you interact with your remote repository. An example SSH URL is
ssh://git@<server>/<name>/<project>.git
.
Click Clone.
By default, MATLAB performs a full clone of the repository. To create a shallow clone from a specific number of commits, select the Only clone the last number commits checkbox. Then, specify the number of commits you want to include in your clone.
See Also
Functions
gitrepo
|gitclone
|createBranch
|switchBranch
|fetch
|merge
|push