loading...

Configure a custom Git repository on Netlify

olistik profile image olistik ・1 min read

My personal web site (https://olisti.co) is a Gatsby.js project I used to serve publicly through Netlify but this required me to use Github.

Since I have my own Gitlab instance (https://source.olisti.co) I wanted to configure Netlify's CI to point to my Gitlab repository instead.

After a few attempts, I discovered that it's currently not possible to update the repository URL via:

  • the web UI: since it doesn't provide the option to specify a self-hosted Gitlab instance or to specify a manual Git URL.
  • netlify api updateSite since passing a build_settings object doesn't change the remote configuration, at least for the repo_url attribute.

I had to delete and recreate the Netlify site and configure it with netlify-cli specifying these parameters:

λ netlify sites:create --manual --with-ci

Here, --with-ci does the trick since it allows to specify the ssh URL of the Git repository.

One last hiccup has been while trying to provision the Let's Encrypt SSL certificate. A worrying error message showed up even though the required checks were passing.

It eventually went away after, I suppose, their local cache expired.

And now that I know this, I can import my other repositories. ;-)

Discussion

pic
Editor guide