can we deploy a specific folder inside GitHub repository?

Viewed 195

I have made a repository on Github "Front-end Projects". The plan is to make front-end projects with different difficulty levels. Hence, the repository is going to have many nested folders.

Now, the problem is I am trying to deploy a folder of a website I created on netlify but I cannot access the folder but only the repository. Is there any way to deploy these projects?

My folder hierarchy is like this. "Front-end Project" is the Repository I pushed on GitHub:

Folder hierarchy

1 Answers

For Netlify support

There are some projects that live in a folder instead of the root of your git repository.

If you need to deploy your site from a subdirectory, there are two ways to do it:

  1. You can set this in the UI:
    https://aws1.discourse-cdn.com/netlify/original/2X/7/763e3be54cbcfa9187754c7626816ed69a8ddf66.png

In your site dashboard for the specific site you want to configure, go to Settings > Build & deploy > build-settings.
The option is labeled Base directory.

  1. Or, your can use a netlify.toml file and set the base dir:
[build]
 base    = "subdirectory"
 publish = "subdirectory/dist/"
 command = "your build command"

Now, your builds will work from the subdirectory folder mentioned above! If you have any issues, comment below.

Note that enabling the base setting can have other effects on your site, which are described in this article and in more detail in our documentation.

Related