通过Git提供关于网站gestion的建议:图片和其他大文件 [英] Advises on the gestion of a website via Git : Images and other big files

查看:137
本文介绍了通过Git提供关于网站gestion的建议:图片和其他大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站完全gestionned由Git。总之,我在本地开发我的网站,当我达到一个值得上网的结果时,我只需输入 git push (没有passwd感谢公钥,或其他任何东西)和3秒钟后,我的新网站在线。



其实,我完全喜欢这个系统,我想用Git正在学习4天左右)尽可能多,尽可能聪明。对于很多的事情。

对于网站主题,困扰我的是我需要大的文件(=不是源代码),如图像标识,背景等)或PDF文件(简历,科学论文)。如果我理解的很好,这些文件只是从一个版本保存到下一个,因为增量不准确。事实上,旧的通常是无用的(谁在关心旧的回乡或者从现在开始的不完整的CV?),并且很可能需要大量的记忆(如果我在每个事件中更新我的简历,随着时间的推移,一个例子)。

因此,对于这个项目,以及更多之后,我想有一个IN IT的git目录: >
- 我想用作存储库的所有常见git文件的项目文件(主要是源代码),并且可以备份它的后面跟踪

- a在每个 commit + push 中更新的目录(我们称之为 data / ),但是之前的文件绝对丢失了遥远的git回购

这个想法是:

- 避免内存爆炸

- 允许谁通过这一事实使得一个工作的本地项目(甚至是一个以前的分支)具有最新的 data / (新标识和新的简历在前者网站为我们的研究案例)

- 让我的生活变得更简单,我的女友更快乐所有的想法都受到欢迎,但请注意,我的理念是喜欢高级别的解决方案。

解决方案

我的最终解决方案并没有保留历史(但我可以在后来的附件中做)但它非常简单而且高效,使用小而简单可靠的 rsync 。我只在我的本地计算机上使用与服务器名称相同的网站。



以下是 .bashrc 我加了:

$ $ $ $ $ $ $ $ $ b rsync -az -del -progress -e ssh〜/ www / $ var / files / admin @ domain:/ var / www / $ var / files /
}

deploy (){
upload
git push
}

完美的人际交往,这是我的网页孤独gestion。



但我读了很多关于Nexus,我会记住更大的项目。 / p>

对于读者来说:对于像medc-size这样的项目,有很多解决方案,比如 git-annex git-fat <​​/ code> git-media git-annex git -data ...你没有更多的借口不能正确处理你的大文件!


I have a website completely gestionned by Git. In a word, I develop my site web on my local place and when I reach a result which deserves to be online, I simply enter git push (without passwd thanks to public key, or any other thing) and 3 seconds later my new website is online.

In fact, I am completely fond of this system and I want to use Git (which I am learning for about 4 days) as much and as smartly as possible. For a lot of things.

For the website topic, what is bothering me is that I need "big" files (= which is not source code) such as images (logo, background, ...) or PDF files (CV, scientific papers). If I understand well, these files are just saved from a version to the next as the "deltas" are not accurate. In fact, the old one are usually useless (who cares about the old back grounnd or the from now on uncomplete CV ?) and are very likely to take a lot of memory (if I update my CV at each event, as an example) with the time going.

So for this project, and for more after, I want to have a git directory with IN IT :
- the files of the project (mostly source code) I want to use as all common git files of a repository, and have a back trace of it with the possibility of backup
- a directory (let's call him data/) which is updated at each commit + push but of which former files are since then definitely lost on the distant git repo

The idea is to :
- avoid the memory explosion
- allow people who makes a pull (even for a former branch) to have by this one fact a working local project, but with the latest data/ (the new logo and new CV on the former website for our study case)
- makes my life simplier and my girl friend happier

All ideas are welcomed, but please notice that it is in my philosophy to prefer high level solutions.

解决方案

My final solution doesn't keep the history (but I could do it later in an annex file) but is dramatically simple and efficient, with the tiny but easy and reliable rsync. I just have my websites on my local computer with the same name as in the server.

Here is the part of my .bashrc I added :

upload() {
local var=`basename $PWD`
rsync -az --del --progress -e ssh ~/www/$var/files/ admin@domain:/var/www/$var/files/
}

deploy() {
upload
git push
}

It is perfect for my personnal use which is a lonely gestion of my web pages.

But I read a lot about Nexus, and I will keep it in mind for bigger project.

For readers : you have a lot of solutions for med-sized project like git-annex git-fat git-media git-annex git-data... You have no more excuses not to handle properly your large files !

这篇关于通过Git提供关于网站gestion的建议:图片和其他大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆