简体   繁体   中英

git clone - user generated content missing

For my first phalcon-project i decided to choose fortrabbit-hosting, althought i haven't got any strong experience with git. I worked in one master-tree, which was commited and pushed continuously. I have some folders, which are full of user-generated-content (image-uploads). To not delete this files after doing new commits i put this folders to my .gitignore file. But how can i update my local repository with this user-generated-content? git pull or git fetch didn't work for this scenario. And whats the right way of using git for deploying to live-stage?

Your code base is part of Git, you might use Git to deploy that to a webspace. The webspace itself is not in Git. The remote Git repo syncs or copies it's contents to the webspace.

It's not a matter of setting the right .gitignore rules. The files on the webspace can change: When the software rights temp-, log-, cache-files or user-uploads for instance. Another example is, when using a "web-installer" (think WordPress updates). All these changes will not be reflected in Git — as it is not a good practice to store such runtime data in Git and as there is no way, to sync back those changes to the Git repo (so you could pull these changes back in). It's not possible and it's also not what you want.

There are multiple approaches to deal with this situation, the two most common patterns are:

  1. Most professional is to follow the 12-factor design pattern: Code and content are strictly separated. User generated content will be stored off-site. With each Git push, the code base will be re-packaged and re-deployed. The storage for the Apps is ephemeral, on each (atomic) deployment the complete code base will be replaced with the new contents. The Professional Stack with fortrabbit is designed like that.

  2. More convenient — especially for legacy thinking/design — is a solution like the fortrabbit Universal Stack, where during deployment new files from the Git repo will be "synced" in the webspace, with "overwrite but do not delete". The webspace is persistent and one can login via SSH/SFTP to grab and download all the files, when necessary.

Please ask carefully. This question might not be general enough to be of interest for Stack Overflow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM