theking2
theking2

Reputation: 2842

how to deploy a git repo but ignore certain folders

I have a repo that includes DDL SQL scripts for create tables views, procedures and functions. I don't want these to be published on a website or made accesible there for obvious reasons. I do want them in de repo however.

How would I deploy a repo to plesk but ignore but one folder?

Upvotes: 0

Views: 68

Answers (3)

jthill
jthill

Reputation: 60487

Git's got facilities for simple stuff like this, it's easy, deploy with an archive.

Simplest example:

git archive @ | tar Cxf /path/to/deployment - 

with no export control attributes set is basically git checkout without the repo tagging along, but you can tell Git to get selective:

echo \*.sql export-ignore >>.gitattributes; git commit .gitattributes -m "don't export *.sql"
git archive @ | tar Cxf /path/to/deployment -

and now any .sql files won't be included in the archive.

You can even do some markup, stuff the exported commit id and such in the archives there's examples in the Git book

Upvotes: 0

Jeroen3
Jeroen3

Reputation: 935

Put the files into a submodule and don't --recurse-submodules on deploy.
For safety, you could disable access to this submodule for the deploy user.

However, I think you may be better off using some CI/CD to create release packages for you to deploy (or have automatically deploy) to your page.

Upvotes: 0

Vimal Patel
Vimal Patel

Reputation: 119

Use .pleskignore File (Best for Plesk Git Integration) Plesk supports a .pleskignore file, similar to .gitignore. Add a .pleskignore file at the root of your repo and specify the folder to exclude

sql/

This ensures that the sql/ folder is ignored when deploying via Plesk’s Git integration

Use .gitignore and Keep SQL Files Locally If you're using Git for Plesk deployment, you can add sql/ to .gitignore

Upvotes: 0

Related Questions