Netlify CLI clone command
Clone a repository and link it to a Netlify project
You can clone from:
- A GitHub/GitLab repository URL or shorthand (e.g., owner/repo)
- A Netlify site name (e.g., my-site)
- A Netlify site URL (e.g., https://my-site.netlify.app)
When cloning a Netlify site that has a connected repository, the repository will be cloned from the connected source (GitHub, GitLab, etc.).
If you specify a target directory, the repo will be cloned into that directory. By default, a directory will be created with the name of the repo or site.
Usage
netlify cloneArguments
- repository - Repository URL, GitHub shorthand (owner/repo), Netlify site name, or Netlify site URL
- targetDir - directory in which to clone the repository - will be created if it does not exist
Flags
filter(string) - For monorepos, specify the name of the application to run the command inid(string) - ID of existing Netlify project to link to (only for GitHub/GitLab repos)name(string) - Name of existing Netlify project to link to (only for GitHub/GitLab repos)debug(boolean) - Print debugging informationauth(string) - Netlify auth token - can be used to run this command without logging in
Examples
netlify clone my-site-namenetlify clone https://my-site.netlify.appnetlify clone https://app.netlify.com/sites/my-sitenetlify clone vibecoder/next-unicornnetlify clone https://github.com/vibecoder/next-unicorn.gitnetlify clone git@github.com:vibecoder/next-unicorn.gitnetlify clone vibecoder/next-unicorn ./next-unicorn-shh-secretnetlify clone --id 123-123-123-123 vibecoder/next-unicornnetlify clone --name my-project-name vibecoder/next-unicornnetlify clone my-site-name ./local-folder