[Support Guide] Using the Command Line Interface to manually link a git repository

Last reviewed by Netlify Support in Oct 2021

If you want to link your Netlify site to your repo without using our User Interface (UI), but still want all of the benefits that come with continuous deployment, our Command Line Interface (CLI) tool is for you!

Currently, our UI allows repo linking only via GitHub, GitLab, and Bitbucket repos as hosted by the creator of those services for most customers. As of late 2020, if you are on the Business plan or higher, you can also link through our UI to self-hosted repositories of those flavors too!

But, what if your repo is somewhere else? Maybe you have a self-hosted GitLab repo or a GitHub Enterprise repo and you don’t have a Business level account. Or, maybe you just like using the command line for everything. As long as you have a Netlify account, a git repo, and a dream, we can make this happen.

The CLI also works without Netlify’s continuous deployment. This is a good option when you’re using a separate Continuous Integration (CI) tool, deploying prebuilt files to Netlify at the end of the CI tool tasks.

To grab the new CLI, pop open your terminal and run:

npm install netlify-cli --global

After you’ve installed the CLI, you have access to a bunch of fancy features:

If you’re ready to get started using the CLI and link your repo to your site, check out our main CLI documentation with its easy to follow, step-by-step instructions. Specifically, to link manually to a repository, start here. We also have the list of possible commands documented here for easy reference. Handy!

4 Likes