Riebel
Riebel

Reputation: 789

Git checkout deletes website uploads

I am using Git for simple website development and deployment.

I develop on localhost, pushing my changes to the server which deploys the web to the corresponding directory via posthook and

GIT_WORK_TREE=/var/www/website/httpdocs/ git checkout -f

My problem is that all user uploads on the live server (uploaded by the website users or via backend) get deleted which live in

/var/www/website/httpdocs/assets/uploads

How can I keep these files when automatically checking out/deploying the web without tracking them in my repository?

Upvotes: 2

Views: 112

Answers (3)

kayaker243
kayaker243

Reputation: 2638

What you want to do is move your user upload directory outside webroot and symlink from webroot to the user upload directory.

For reference: https://serverfault.com/questions/147185/website-deployment-managing-user-uploaded-content

Upvotes: 2

willoller
willoller

Reputation: 7330

I think what you want is to not track them at all.

Try adding this to your .gitignore file:

assets/uploads/*

Upvotes: 1

Mandar
Mandar

Reputation: 498

If i understand your problem correctly, use git stash and git stash pop.

Upvotes: 0

Related Questions